src/menus/SelectMenus.cpp
// Handles moving a selection edge with the keyboard in snap-to-time mode;
// returns the moved value.
// Will move at least minPix pixels -- set minPix positive to move forward,
// negative to move backward.
// Helper for moving by keyboard with snap-to-grid enabled
Handles moving a selection edge with the keyboard in snap-to-time mode;
returns the moved value.
Will move at least minPix pixels -- set minPix positive to move forward,
negative to move backward.
Helper for moving by keyboard with snap-to-grid enabled
Handles moving a selection edge with the keyboard in snap - to - time mode ; returns the moved value . Will move at least minPix pixels -- set minPix positive to move forward negative to move backward . Helper for moving by keyboard with snap - to - grid enabled
double GridMove
(AudacityProject &project, double t, int minPix)
{
   auto &settings = ProjectSettings::Get(project);
   auto rate = ProjectRate::Get(project).GetRate();
   auto &viewInfo = ViewInfo::Get( project );
   auto format = settings.GetSelectionFormat();
   NumericConverter nc(NumericConverter::TIME, format, t, rate);
   double result;
   minPix >= 0 ? nc.Increment() : nc.Decrement();
   result = nc.GetValue();
   if (std::abs(viewInfo.TimeToPosition(result) - viewInfo.TimeToPosition(t))
       >= abs(minPix))
       return result;
   result = viewInfo.OffsetTimeByPixels(t, minPix);
   nc.SetValue(result);
   result = nc.GetValue();
   return result;
}
double GridMove ( AudacityProject & project , double t , int minPix ) { auto & settings = ProjectSettings :: Get ( project ) ; auto rate = ProjectRate :: Get ( project ) . GetRate ( ) ; auto & viewInfo = ViewInfo :: Get ( project ) ; auto format = settings . GetSelectionFormat ( ) ; NumericConverter nc ( NumericConverter :: TIME , format , t , rate ) ; double result ; minPix >= 0 ? nc . Increment ( ) : nc . Decrement ( ) ; result = nc . GetValue ( ) ; if ( std :: abs ( viewInfo . TimeToPosition ( result ) - viewInfo . TimeToPosition ( t ) ) >= abs ( minPix ) ) return result ; result = viewInfo . OffsetTimeByPixels ( t , minPix ) ; nc . SetValue ( result ) ; result = nc . GetValue ( ) ; return result ; }
Handles moving a selection edge with the keyboard in snap-to-time mode;
returns the moved value.
Handles moving a selection edge with the keyboard in snap - to - time mode ; returns the moved value .
// Try incrementing/decrementing the value; if we've moved far enough we're // done // Otherwise, move minPix pixels, then snap to the time.