src/menus/SelectMenus.cpp
// Moving a cursor, and collapsed selection.
Moving a cursor, and collapsed selection.
Moving a cursor and collapsed selection .
void MoveWhenAudioInactive
(AudacityProject &project, double seekStep, TimeUnit timeUnit)
{
   auto &viewInfo = ViewInfo::Get( project );
   auto &trackPanel = TrackPanel::Get( project );
   auto &tracks = TrackList::Get( project );
   auto &ruler = AdornedRulerPanel::Get( project );
   const auto &settings = ProjectSettings::Get( project );
   auto &window = ProjectWindow::Get( project );
   int snapToTime = settings.GetSnapTo();
   const double t0 = viewInfo.selectedRegion.t0();
   const double end = std::max( 
      tracks.GetEndTime(),
      viewInfo.GetScreenEndTime());
   if( viewInfo.selectedRegion.isPoint() )
   {
      double newT = OffsetTime(project,
         t0, seekStep, timeUnit, snapToTime);
      newT = std::max(0.0, newT);
      newT = std::min(newT, end);
      viewInfo.selectedRegion.setT0(
         newT,
         false); 
      viewInfo.selectedRegion.collapseToT0();
      the visual cursor, avoiding an unnecessary complete redraw
      trackPanel.DrawOverlays(false);
      ruler.DrawOverlays(false);
   }
   else
   {
      if( seekStep < 0 )
         viewInfo.selectedRegion.collapseToT0();
      else
         viewInfo.selectedRegion.collapseToT1();
      trackPanel.Refresh(false);
   }
   window.ScrollIntoView(viewInfo.selectedRegion.t1());
   return;
}
void MoveWhenAudioInactive ( AudacityProject & project , double seekStep , TimeUnit timeUnit ) { auto & viewInfo = ViewInfo :: Get ( project ) ; auto & trackPanel = TrackPanel :: Get ( project ) ; auto & tracks = TrackList :: Get ( project ) ; auto & ruler = AdornedRulerPanel :: Get ( project ) ; const auto & settings = ProjectSettings :: Get ( project ) ; auto & window = ProjectWindow :: Get ( project ) ; int snapToTime = settings . GetSnapTo ( ) ; const double t0 = viewInfo . selectedRegion . t0 ( ) ; const double end = std :: max ( tracks . GetEndTime ( ) , viewInfo . GetScreenEndTime ( ) ) ; if ( viewInfo . selectedRegion . isPoint ( ) ) { double newT = OffsetTime ( project , t0 , seekStep , timeUnit , snapToTime ) ; newT = std :: max ( 0.0 , newT ) ; newT = std :: min ( newT , end ) ; viewInfo . selectedRegion . setT0 ( newT , false ) ; viewInfo . selectedRegion . collapseToT0 ( ) ; trackPanel . DrawOverlays ( false ) ; ruler . DrawOverlays ( false ) ; } else { if ( seekStep < 0 ) viewInfo . selectedRegion . collapseToT0 ( ) ; else viewInfo . selectedRegion . collapseToT1 ( ) ; trackPanel . Refresh ( false ) ; } window . ScrollIntoView ( viewInfo . selectedRegion . t1 ( ) ) ; return ; }
Moving a cursor, and collapsed selection.
Moving a cursor and collapsed selection .
// If TIME_UNIT_SECONDS, snap-to will be off. // Move the cursor // Already in cursor mode? // constrain. // Move  // do not swap selection boundaries // Move the visual cursor, avoiding an unnecessary complete redraw // Transition to cursor mode. // Make sure NEW position is in view