mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Eliminate msClipLen since it leads to length errors in WaveTrack and WaveClip.
This commit is contained in:
parent
5c48047d0e
commit
1d6e1593ee
@ -1413,7 +1413,7 @@ wxUint32 AudacityProject::GetUpdateFlags()
|
|||||||
t = iter.Next();
|
t = iter.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msClipLen > 0.0)
|
if((msClipT1 - msClipT0) > 0.0)
|
||||||
flags |= ClipboardFlag;
|
flags |= ClipboardFlag;
|
||||||
|
|
||||||
if (mUndoManager.UnsavedChanges())
|
if (mUndoManager.UnsavedChanges())
|
||||||
@ -3127,7 +3127,8 @@ void AudacityProject::OnCut()
|
|||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
msClipLen = (mViewInfo.sel1 - mViewInfo.sel0);
|
msClipT0 = mViewInfo.sel0;
|
||||||
|
msClipT1 = mViewInfo.sel1;
|
||||||
msClipProject = this;
|
msClipProject = this;
|
||||||
|
|
||||||
PushState(_("Cut to the clipboard"), _("Cut"));
|
PushState(_("Cut to the clipboard"), _("Cut"));
|
||||||
@ -3167,7 +3168,8 @@ void AudacityProject::OnSplitCut()
|
|||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
msClipLen = (mViewInfo.sel1 - mViewInfo.sel0);
|
msClipT0 = mViewInfo.sel0;
|
||||||
|
msClipT1 = mViewInfo.sel1;
|
||||||
msClipProject = this;
|
msClipProject = this;
|
||||||
|
|
||||||
PushState(_("Split-cut to the clipboard"), _("Split Cut"));
|
PushState(_("Split-cut to the clipboard"), _("Split Cut"));
|
||||||
@ -3212,7 +3214,6 @@ void AudacityProject::OnCopy()
|
|||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
msClipLen = (mViewInfo.sel1 - mViewInfo.sel0); // MJS: to be removed in future
|
|
||||||
msClipT0 = mViewInfo.sel0;
|
msClipT0 = mViewInfo.sel0;
|
||||||
msClipT1 = mViewInfo.sel1;
|
msClipT1 = mViewInfo.sel1;
|
||||||
msClipProject = this;
|
msClipProject = this;
|
||||||
@ -3279,7 +3280,7 @@ void AudacityProject::OnPaste()
|
|||||||
{
|
{
|
||||||
// Must perform sync-lock adjustment before incrementing n
|
// Must perform sync-lock adjustment before incrementing n
|
||||||
if (n->IsSyncLockSelected()) {
|
if (n->IsSyncLockSelected()) {
|
||||||
bPastedSomething |= n->SyncLockAdjust(t1, t0+msClipLen);
|
bPastedSomething |= n->SyncLockAdjust(t1, t0+(msClipT1 - msClipT0));
|
||||||
}
|
}
|
||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
}
|
}
|
||||||
@ -3327,7 +3328,7 @@ void AudacityProject::OnPaste()
|
|||||||
// To be (sort of) consistent with Clear behavior, we'll only shift
|
// To be (sort of) consistent with Clear behavior, we'll only shift
|
||||||
// them if linking is on
|
// them if linking is on
|
||||||
if (IsSyncLocked())
|
if (IsSyncLocked())
|
||||||
((LabelTrack *)n)->ShiftLabelsOnInsert(msClipLen, t0);
|
((LabelTrack *)n)->ShiftLabelsOnInsert(msClipT1 - msClipT0, t0);
|
||||||
|
|
||||||
bPastedSomething |= ((LabelTrack *)n)->PasteOver(t0, c);
|
bPastedSomething |= ((LabelTrack *)n)->PasteOver(t0, c);
|
||||||
}
|
}
|
||||||
@ -3366,7 +3367,7 @@ void AudacityProject::OnPaste()
|
|||||||
} // if (n->GetSelected())
|
} // if (n->GetSelected())
|
||||||
else if (n->IsSyncLockSelected())
|
else if (n->IsSyncLockSelected())
|
||||||
{
|
{
|
||||||
bPastedSomething |= n->SyncLockAdjust(t1, t0 + msClipLen);
|
bPastedSomething |= n->SyncLockAdjust(t1, t0 + msClipT1 - msClipT0);
|
||||||
}
|
}
|
||||||
|
|
||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
@ -3389,7 +3390,7 @@ void AudacityProject::OnPaste()
|
|||||||
}else{
|
}else{
|
||||||
WaveTrack *tmp;
|
WaveTrack *tmp;
|
||||||
tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
|
tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
|
||||||
tmp->InsertSilence(0.0, msClipLen);
|
tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct?
|
||||||
tmp->Flush();
|
tmp->Flush();
|
||||||
|
|
||||||
bPastedSomething |=
|
bPastedSomething |=
|
||||||
@ -3404,11 +3405,11 @@ void AudacityProject::OnPaste()
|
|||||||
|
|
||||||
// As above, only shift labels if linking is on
|
// As above, only shift labels if linking is on
|
||||||
if (IsSyncLocked())
|
if (IsSyncLocked())
|
||||||
((LabelTrack *)n)->ShiftLabelsOnInsert(msClipLen, t0);
|
((LabelTrack *)n)->ShiftLabelsOnInsert(msClipT1 - msClipT0, t0);
|
||||||
}
|
}
|
||||||
else if (n->IsSyncLockSelected())
|
else if (n->IsSyncLockSelected())
|
||||||
{
|
{
|
||||||
n->SyncLockAdjust(t1, t0 + msClipLen);
|
n->SyncLockAdjust(t1, t0 + msClipT1 - msClipT0);
|
||||||
}
|
}
|
||||||
|
|
||||||
n = iter.Next();
|
n = iter.Next();
|
||||||
@ -3419,8 +3420,7 @@ void AudacityProject::OnPaste()
|
|||||||
|
|
||||||
if (bPastedSomething)
|
if (bPastedSomething)
|
||||||
{
|
{
|
||||||
mViewInfo.sel0 = t0;
|
mViewInfo.sel1 = t0 + msClipT1 - msClipT0;
|
||||||
mViewInfo.sel1 = t0 + msClipLen;
|
|
||||||
|
|
||||||
PushState(_("Pasted from the clipboard"), _("Paste"));
|
PushState(_("Pasted from the clipboard"), _("Paste"));
|
||||||
|
|
||||||
@ -3545,8 +3545,8 @@ bool AudacityProject::HandlePasteNothingSelected()
|
|||||||
// So do it at the sample rate of the project
|
// So do it at the sample rate of the project
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
double projRate = p->GetRate();
|
double projRate = p->GetRate();
|
||||||
double quantT0 = (double)((sampleCount)floor(msClipT0 * projRate + 0.5))/projRate;
|
double quantT0 = QUANTIZED_TIME(msClipT0, projRate);
|
||||||
double quantT1 = (double)((sampleCount)floor(msClipT1 * projRate + 0.5))/projRate;
|
double quantT1 = QUANTIZED_TIME(msClipT1, projRate);
|
||||||
mViewInfo.sel0 = 0.0; // anywhere else and this should be half a sample earlier
|
mViewInfo.sel0 = 0.0; // anywhere else and this should be half a sample earlier
|
||||||
mViewInfo.sel1 = quantT1 - quantT0;
|
mViewInfo.sel1 = quantT1 - quantT0;
|
||||||
|
|
||||||
@ -3632,11 +3632,11 @@ void AudacityProject::OnPasteNewLabel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnPasteOver()
|
void AudacityProject::OnPasteOver() // not currently in use it appears
|
||||||
{
|
{
|
||||||
if(msClipLen>0.0)
|
if((msClipT1 - msClipT0) > 0.0)
|
||||||
{
|
{
|
||||||
mViewInfo.sel1=mViewInfo.sel0+msClipLen;
|
mViewInfo.sel1 = mViewInfo.sel0 + (msClipT1 - msClipT0); // MJS: pointless, given what we do in OnPaste?
|
||||||
}
|
}
|
||||||
OnPaste();
|
OnPaste();
|
||||||
|
|
||||||
|
@ -158,7 +158,6 @@ scroll information. It also has some status flags.
|
|||||||
#include "../images/AudacityLogoAlpha.xpm"
|
#include "../images/AudacityLogoAlpha.xpm"
|
||||||
|
|
||||||
TrackList *AudacityProject::msClipboard = new TrackList();
|
TrackList *AudacityProject::msClipboard = new TrackList();
|
||||||
double AudacityProject::msClipLen = 0.0;
|
|
||||||
double AudacityProject::msClipT0 = 0.0;
|
double AudacityProject::msClipT0 = 0.0;
|
||||||
double AudacityProject::msClipT1 = 0.0;
|
double AudacityProject::msClipT1 = 0.0;
|
||||||
AudacityProject *AudacityProject::msClipProject = NULL;
|
AudacityProject *AudacityProject::msClipProject = NULL;
|
||||||
@ -3667,7 +3666,8 @@ void AudacityProject::DeleteAllProjectsDeleteLock()
|
|||||||
|
|
||||||
void AudacityProject::ClearClipboard()
|
void AudacityProject::ClearClipboard()
|
||||||
{
|
{
|
||||||
msClipLen = 0.0;
|
msClipT0 = 0.0;
|
||||||
|
msClipT1 = 0.0;
|
||||||
msClipProject = NULL;
|
msClipProject = NULL;
|
||||||
if (msClipboard) {
|
if (msClipboard) {
|
||||||
msClipboard->Clear(true);
|
msClipboard->Clear(true);
|
||||||
@ -4095,8 +4095,8 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msClipLen =
|
msClipT0 = regions.Item(0)->start;
|
||||||
regions.Item(regions.GetCount() - 1)->end - regions.Item(0)->start;
|
msClipT1 = regions.Item(regions.GetCount() - 1)->end;
|
||||||
|
|
||||||
//delete label regions
|
//delete label regions
|
||||||
for( unsigned int i = 0; i < regions.GetCount(); i++ )
|
for( unsigned int i = 0; i < regions.GetCount(); i++ )
|
||||||
|
@ -146,7 +146,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||||||
void SetSel0(double); //Added by STM
|
void SetSel0(double); //Added by STM
|
||||||
void SetSel1(double); //Added by STM
|
void SetSel1(double); //Added by STM
|
||||||
|
|
||||||
bool Clipboard() { return msClipLen > 0.0; }
|
bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; }
|
||||||
|
|
||||||
wxString GetName();
|
wxString GetName();
|
||||||
DirManager *GetDirManager();
|
DirManager *GetDirManager();
|
||||||
@ -431,7 +431,6 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||||||
// Clipboard (static because it is shared by all projects)
|
// Clipboard (static because it is shared by all projects)
|
||||||
static TrackList *msClipboard;
|
static TrackList *msClipboard;
|
||||||
static AudacityProject *msClipProject;
|
static AudacityProject *msClipProject;
|
||||||
static double msClipLen; // MJS: to be removed in future - too dangerous!
|
|
||||||
static double msClipT0;
|
static double msClipT0;
|
||||||
static double msClipT1;
|
static double msClipT1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user