MCPcopy Create free account
hub / github.com/audacity/audacity / OnTimer

Method OnTimer

src/tracks/ui/ScrubUI.cpp:109–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void ScrubbingOverlay::OnTimer(Observer::Message)
110{
111 Scrubber &scrubber = GetScrubber();
112 const auto isScrubbing = scrubber.IsScrubbing();
113 auto &ruler = AdornedRulerPanel::Get( *mProject );
114 auto position = ::wxGetMousePosition();
115
116 if (scrubber.IsSpeedPlaying() || scrubber.IsKeyboardScrubbing())
117 return;
118
119 {
120 if(scrubber.HasMark()) {
121 auto xx = ruler.ScreenToClient(position).x;
122 ruler.UpdateQuickPlayPos( xx );
123
124 if (!isScrubbing)
125 // Really start scrub if motion is far enough
126 scrubber.MaybeStartScrubbing(xx);
127 }
128
129 if (!isScrubbing) {
130 mNextScrubRect = wxRect();
131 return;
132 }
133 else
134 ruler.DrawBothOverlays();
135 }
136
137 if (!scrubber.ShouldDrawScrubSpeed()) {
138 mNextScrubRect = wxRect();
139 }
140 else {
141 auto &trackPanel = GetProjectPanel( *mProject );
142 auto &viewInfo = ViewInfo::Get( *mProject );
143 int panelWidth, panelHeight;
144 trackPanel.GetSize(&panelWidth, &panelHeight);
145
146 // Where's the mouse?
147 position = trackPanel.ScreenToClient(position);
148
149 const bool seeking = scrubber.Seeks() || scrubber.TemporarilySeeks();
150
151 // Find the text
152 const double maxScrubSpeed = GetScrubber().GetMaxScrubSpeed();
153 const double speed =
154 scrubber.IsScrollScrubbing()
155 ? scrubber.FindScrubSpeed( seeking,
156 ViewInfo::Get( *mProject )
157 .PositionToTime(position.x, viewInfo.GetLeftOffset()))
158 : maxScrubSpeed;
159
160 const wxChar *format =
161 scrubber.IsScrollScrubbing()
162 ? seeking
163 ? wxT("%+.2fX")
164 : wxT("%+.2f")
165 : wxT("%.2f");
166

Callers

nothing calls this directly

Calls 15

GetFunction · 0.85
maxFunction · 0.85
UpdateQuickPlayPosMethod · 0.80
MaybeStartScrubbingMethod · 0.80
DrawBothOverlaysMethod · 0.80
ShouldDrawScrubSpeedMethod · 0.80
SeeksMethod · 0.80
TemporarilySeeksMethod · 0.80
FindScrubSpeedMethod · 0.80
PositionToTimeMethod · 0.80
GetLeftOffsetMethod · 0.80
SetFontMethod · 0.80

Tested by

no test coverage detected