1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

New attached structure ProjectSettings stores rate, snap-to, et al.

This commit is contained in:
Paul Licameli
2019-05-27 10:17:16 -04:00
parent 327845b0ee
commit dd10e00a2d
40 changed files with 371 additions and 228 deletions

View File

@@ -72,9 +72,10 @@ SnapManager::~SnapManager()
void SnapManager::Reinit()
{
int snapTo = mProject->GetSnapTo();
double rate = mProject->GetRate();
auto format = mProject->GetSelectionFormat();
const auto &settings = ProjectSettings::Get( *mProject );
int snapTo = settings.GetSnapTo();
double rate = settings.GetRate();
auto format = settings.GetSelectionFormat();
// No need to reinit if these are still the same
if (snapTo == mSnapTo && rate == mRate && format == mFormat)
@@ -329,7 +330,10 @@ SnapResults SnapManager::Snap
if (mSnapToTime) {
// Find where it would snap time to the grid
mConverter.ValueToControls(t, GetActiveProject()->GetSnapTo() == SNAP_NEAREST);
mConverter.ValueToControls(
t,
ProjectSettings::Get( *GetActiveProject() ).GetSnapTo() == SNAP_NEAREST
);
mConverter.ControlsToValue();
results.timeSnappedTime = mConverter.GetValue();
}