1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +02:00

Move GetEditClipsCanMove to global function in TracksBehaviorsPrefs.cpp

This commit is contained in:
Paul Licameli 2020-03-04 13:52:10 -05:00
parent a284f57e39
commit 046ee21e72
6 changed files with 24 additions and 20 deletions

View File

@ -189,21 +189,6 @@ AudacityPrefs::AudacityPrefs(const wxString& appName,
// Bug 825 is essentially that SyncLock requires EditClipsCanMove.
// SyncLock needs rethinking, but meanwhile this function
// fixes the issues of Bug 825 by allowing clips to move when in
// SyncLock.
bool AudacityPrefs::GetEditClipsCanMove()
{
bool mIsSyncLocked;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
if( mIsSyncLocked )
return true;
bool editClipsCanMove;
Read(wxT("/GUI/EditClipCanMove"), &editClipsCanMove, true);
return editClipsCanMove;
}
void InitPreferences( const wxFileName &configFileName )
{
wxString appName = wxTheApp->GetAppName();

View File

@ -64,7 +64,6 @@ public:
const wxString& globalFilename = {},
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
const wxMBConv& conv = wxConvAuto());
bool GetEditClipsCanMove();
// Set and Get values of the version major/minor/micro keys in audacity.cfg when Audacity first opens
void SetVersionKeysInit( int major, int minor, int micro)

View File

@ -57,6 +57,7 @@ Track classes.
#include "prefs/QualityPrefs.h"
#include "prefs/SpectrogramSettings.h"
#include "prefs/TracksPrefs.h"
#include "prefs/TracksBehaviorsPrefs.h"
#include "prefs/WaveformSettings.h"
#include "InconsistencyException.h"
@ -940,7 +941,7 @@ void WaveTrack::HandleClear(double t0, double t1,
if (t1 < t0)
THROW_INCONSISTENCY_EXCEPTION;
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
bool editClipCanMove = GetEditClipsCanMove();
WaveClipPointers clipsToDelete;
WaveClipHolders clipsToAdd;
@ -1113,7 +1114,7 @@ void WaveTrack::SyncLockAdjust(double oldT1, double newT1)
void WaveTrack::Paste(double t0, const Track *src)
// WEAK-GUARANTEE
{
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
bool editClipCanMove = GetEditClipsCanMove();
bool bOk = src && src->TypeSwitch< bool >( [&](const WaveTrack *other) {
@ -2356,7 +2357,7 @@ void WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart,
double* cutlineEnd)
// STRONG-GUARANTEE
{
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
bool editClipCanMove = GetEditClipsCanMove();
// Find clip which contains this cut line
double start = 0, end = 0;

View File

@ -20,6 +20,7 @@
#include "../Prefs.h"
#include "../ViewInfo.h"
#include "../WaveTrack.h"
#include "../prefs/TracksBehaviorsPrefs.h"
#include "TimeWarper.h"
@ -43,7 +44,7 @@ bool Generator::Process()
[&](WaveTrack *track, const Track::Fallthrough &fallthrough) {
if (!track->GetSelected())
return fallthrough();
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
bool editClipCanMove = GetEditClipsCanMove();
//if we can't move clips, and we're generating into an empty space,
//make sure there's room.

View File

@ -143,3 +143,18 @@ PrefsPanel::Registration sAttachment{ "TracksBehaviors",
{ "Tracks" }
};
}
// Bug 825 is essentially that SyncLock requires EditClipsCanMove.
// SyncLock needs rethinking, but meanwhile this function
// fixes the issues of Bug 825 by allowing clips to move when in
// SyncLock.
bool GetEditClipsCanMove()
{
bool mIsSyncLocked;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
if( mIsSyncLocked )
return true;
bool editClipsCanMove;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipsCanMove, true);
return editClipsCanMove;
}

View File

@ -42,4 +42,7 @@ class TracksBehaviorsPrefs final : public PrefsPanel
};
extern ChoiceSetting TracksBehaviorsSolo;
bool GetEditClipsCanMove();
#endif