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

Method ScrollUpDown

libraries/lib-viewport/Viewport.cpp:240–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240bool Viewport::ScrollUpDown(int delta)
241{
242 int oldPos = mpCallbacks ? mpCallbacks->GetVerticalThumbPosition() : 0;
243 int pos = oldPos + delta;
244 int max = mpCallbacks
245 ? mpCallbacks->GetVerticalRange() - mpCallbacks->GetVerticalThumbSize()
246 : 0;
247
248 // Can be negative in case of only one track
249 if (max < 0)
250 max = 0;
251
252 if (pos > max)
253 pos = max;
254 else if (pos < 0)
255 pos = 0;
256
257 if (pos != oldPos)
258 {
259 if (mpCallbacks)
260 mpCallbacks->SetVerticalThumbPosition(pos);
261
262 DoScroll();
263 return true;
264 }
265 else
266 return false;
267}
268
269void Viewport::UpdateScrollbarsForTracks()
270{

Callers 1

Calls 4

GetVerticalRangeMethod · 0.45
GetVerticalThumbSizeMethod · 0.45

Tested by

no test coverage detected