Bug 825 - Sync Lock behaves inconsistently when moving of clips is disabled

Sync Lock on now means clips can move.  So it 'trumps' that setting, when on.
This commit is contained in:
James Crook 2018-04-11 18:13:37 +01:00
parent b8f13f7698
commit 2d2f282c83
4 changed files with 58 additions and 13 deletions

View File

@ -68,8 +68,9 @@
#include "widgets/ErrorDialog.h"
#include "Internat.h"
std::unique_ptr<wxFileConfig> ugPrefs {};
wxFileConfig *gPrefs = NULL;
std::unique_ptr<AudacityPrefs> ugPrefs {};
AudacityPrefs *gPrefs = NULL;
int gMenusDirty = 0;
#if 0
@ -133,13 +134,45 @@ static void CopyEntriesRecursive(wxString path, wxConfigBase *src, wxConfigBase
}
#endif
AudacityPrefs::AudacityPrefs(const wxString& appName,
const wxString& vendorName,
const wxString& localFilename,
const wxString& globalFilename,
long style,
const wxMBConv& conv) :
wxFileConfig(appName,
vendorName,
localFilename,
globalFilename,
style,
conv)
{
}
// 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()
{
wxString appName = wxTheApp->GetAppName();
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
ugPrefs = std::make_unique<wxFileConfig>
ugPrefs = std::make_unique<AudacityPrefs>
(appName, wxEmptyString,
configFileName.GetFullPath(),
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);

View File

@ -34,13 +34,29 @@
#include <wx/config.h>
#include <wx/fileconf.h>
#include <wx/convauto.h>
void InitPreferences();
void FinishPreferences();
extern AUDACITY_DLL_API wxFileConfig *gPrefs;
class AudacityPrefs;
extern AUDACITY_DLL_API AudacityPrefs *gPrefs;
extern int gMenusDirty;
class AUDACITY_DLL_API AudacityPrefs : public wxFileConfig
{
public:
AudacityPrefs(const wxString& appName = wxEmptyString,
const wxString& vendorName = wxEmptyString,
const wxString& localFilename = wxEmptyString,
const wxString& globalFilename = wxEmptyString,
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
const wxMBConv& conv = wxConvAuto());
bool GetEditClipsCanMove();
};
// Packages a table of user-visible choices each with an internal code string,
// a preference key path,
// and a default choice

View File

@ -1014,8 +1014,7 @@ void WaveTrack::HandleClear(double t0, double t1,
if (t1 < t0)
THROW_INCONSISTENCY_EXCEPTION;
bool editClipCanMove = true;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove);
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
WaveClipPointers clipsToDelete;
WaveClipHolders clipsToAdd;
@ -1193,9 +1192,8 @@ void WaveTrack::SyncLockAdjust(double oldT1, double newT1)
void WaveTrack::Paste(double t0, const Track *src)
// WEAK-GUARANTEE
{
bool editClipCanMove = true;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove);
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
if( src == NULL )
// THROW_INCONSISTENCY_EXCEPTION; // ?
return;
@ -2476,8 +2474,7 @@ void WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart,
double* cutlineEnd)
// STRONG-GUARANTEE
{
bool editClipCanMove = true;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove);
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
// Find clip which contains this cut line
double start = 0, end = 0;

View File

@ -46,8 +46,7 @@ bool Generator::Process()
if (t->GetKind() == Track::Wave && t->GetSelected()) {
WaveTrack* track = (WaveTrack*)t;
bool editClipCanMove;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove, true);
bool editClipCanMove = gPrefs->GetEditClipsCanMove();
//if we can't move clips, and we're generating into an empty space,
//make sure there's room.