| 74 | } |
| 75 | |
| 76 | void SnapManager::Reinit() |
| 77 | { |
| 78 | const auto &formats = ProjectNumericFormats::Get(*mProject); |
| 79 | const auto &settings = ProjectSnap::Get( *mProject ); |
| 80 | |
| 81 | auto snapTo = settings.GetSnapTo(); |
| 82 | auto snapMode = settings.GetSnapMode(); |
| 83 | |
| 84 | auto rate = ProjectRate::Get(*mProject).GetRate(); |
| 85 | auto format = formats.GetSelectionFormat(); |
| 86 | |
| 87 | // No need to reinit if these are still the same |
| 88 | if (snapTo == mSnapTo && rate == mRate && format == mFormat) |
| 89 | { |
| 90 | return; |
| 91 | } |
| 92 | |
| 93 | // Save NEW settings |
| 94 | mSnapTo = snapTo; |
| 95 | mRate = rate; |
| 96 | mFormat = format; |
| 97 | |
| 98 | mSnapPoints.clear(); |
| 99 | |
| 100 | // Grab time-snapping prefs (unless otherwise requested) |
| 101 | mSnapToTime = snapMode != SnapMode::SNAP_OFF && !mNoTimeSnap; |
| 102 | |
| 103 | // Add a SnapPoint at t=0 |
| 104 | mSnapPoints.push_back(SnapPoint{}); |
| 105 | |
| 106 | // Adjust and filter the candidate points |
| 107 | for (const auto &candidate : mCandidates) |
| 108 | CondListAdd( candidate.t, candidate.track ); |
| 109 | |
| 110 | // Sort all by time |
| 111 | std::sort(mSnapPoints.begin(), mSnapPoints.end()); |
| 112 | } |
| 113 | |
| 114 | // Adds to mSnapPoints, filtering by TimeConverter |
| 115 | void SnapManager::CondListAdd(double t, const Track *track) |
nothing calls this directly
no test coverage detected