1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Select the 'correct' part when pasting in HandlePasteNothingSelected - working up to the more complicated changes required on the same lines.

This commit is contained in:
martynshaw99 2010-09-07 23:10:29 +00:00
parent 50a61e1570
commit ed187aa185
3 changed files with 17 additions and 4 deletions

View File

@ -3212,7 +3212,9 @@ void AudacityProject::OnCopy()
n = iter.Next();
}
msClipLen = (mViewInfo.sel1 - mViewInfo.sel0);
msClipLen = (mViewInfo.sel1 - mViewInfo.sel0); // MJS: to be removed in future
msClipT0 = mViewInfo.sel0;
msClipT1 = mViewInfo.sel1;
msClipProject = this;
//Make sure the menus/toolbar states get updated
@ -3538,8 +3540,15 @@ bool AudacityProject::HandlePasteNothingSelected()
pClip = iterClip.Next();
}
mViewInfo.sel0 = 0.0;
mViewInfo.sel1 = msClipLen;
// Select some pasted samples, which is probably impossible to get right
// with various project and track sample rates.
// So do it at the sample rate of the project
AudacityProject *p = GetActiveProject();
double projRate = p->GetRate();
double quantT0 = (double)((sampleCount)floor(msClipT0 * projRate + 0.5))/projRate;
double quantT1 = (double)((sampleCount)floor(msClipT1 * projRate + 0.5))/projRate;
mViewInfo.sel0 = 0.0; // anywhere else and this should be half a sample earlier
mViewInfo.sel1 = quantT1 - quantT0;
PushState(_("Pasted from the clipboard"), _("Paste"));

View File

@ -159,6 +159,8 @@ scroll information. It also has some status flags.
TrackList *AudacityProject::msClipboard = new TrackList();
double AudacityProject::msClipLen = 0.0;
double AudacityProject::msClipT0 = 0.0;
double AudacityProject::msClipT1 = 0.0;
AudacityProject *AudacityProject::msClipProject = NULL;
ODLock *AudacityProject::msAllProjectDeleteMutex = new ODLock();

View File

@ -431,7 +431,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
// Clipboard (static because it is shared by all projects)
static TrackList *msClipboard;
static AudacityProject *msClipProject;
static double msClipLen;
static double msClipLen; // MJS: to be removed in future - too dangerous!
static double msClipT0;
static double msClipT1;
//shared by all projects
static ODLock *msAllProjectDeleteMutex;