| 107 | } |
| 108 | |
| 109 | void 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 |
nothing calls this directly
no test coverage detected