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

Buig1307: Misbehavior posting mono into stereo

This commit is contained in:
Paul Licameli 2016-01-23 18:25:06 -05:00
parent c703631b8c
commit 4d2f4bbd69

View File

@ -3982,7 +3982,7 @@ void AudacityProject::OnPaste()
Track *c = clipIter.First(); Track *c = clipIter.First();
if (c == NULL) if (c == NULL)
return; return;
Track *f = NULL; Track *ff = NULL;
Track *tmpSrc = NULL; Track *tmpSrc = NULL;
Track *tmpC = NULL; Track *tmpC = NULL;
Track *prev = NULL; Track *prev = NULL;
@ -3994,8 +3994,9 @@ void AudacityProject::OnPaste()
while (n && c) { while (n && c) {
if (n->GetSelected()) { if (n->GetSelected()) {
bAdvanceClipboard = true; bAdvanceClipboard = true;
if (tmpC) c = tmpC; if (tmpC)
if (c->GetKind() != n->GetKind()){ c = tmpC;
if (c->GetKind() != n->GetKind()) {
if (!bTrackTypeMismatch) { if (!bTrackTypeMismatch) {
tmpSrc = prev; tmpSrc = prev;
tmpC = c; tmpC = c;
@ -4005,7 +4006,7 @@ void AudacityProject::OnPaste()
c = tmpSrc; c = tmpSrc;
// If the types still don't match... // If the types still don't match...
while (c && c->GetKind() != n->GetKind()){ while (c && c->GetKind() != n->GetKind()) {
prev = c; prev = c;
c = clipIter.Next(); c = clipIter.Next();
} }
@ -4013,7 +4014,7 @@ void AudacityProject::OnPaste()
// Handle case where the first track in clipboard // Handle case where the first track in clipboard
// is of different type than the first selected track // is of different type than the first selected track
if (!c){ if (!c) {
c = tmpC; c = tmpC;
while (n && (c->GetKind() != n->GetKind() || !n->GetSelected())) while (n && (c->GetKind() != n->GetKind() || !n->GetSelected()))
{ {
@ -4023,13 +4024,14 @@ void AudacityProject::OnPaste()
} }
n = iter.Next(); n = iter.Next();
} }
if (!n) c = NULL; if (!n)
c = NULL;
} }
// The last possible case for cross-type pastes: triggered when we try to // The last possible case for cross-type pastes: triggered when we try to
// paste 1+ tracks from one type into 1+ tracks of another type. If // paste 1+ tracks from one type into 1+ tracks of another type. If
// there's a mix of types, this shouldn't run. // there's a mix of types, this shouldn't run.
if (!c){ if (!c) {
wxMessageBox( wxMessageBox(
_("Pasting one type of track into another is not allowed."), _("Pasting one type of track into another is not allowed."),
_("Error"), wxICON_ERROR, this); _("Error"), wxICON_ERROR, this);
@ -4048,8 +4050,8 @@ void AudacityProject::OnPaste()
break; break;
} }
if (!f) if (!ff)
f = n; ff = n;
if (msClipProject != this && c->GetKind() == Track::Wave) if (msClipProject != this && c->GetKind() == Track::Wave)
((WaveTrack *) c)->Lock(); ((WaveTrack *) c)->Lock();
@ -4083,11 +4085,7 @@ void AudacityProject::OnPaste()
n = iter.Next(); n = iter.Next();
if (n->GetKind() == Track::Wave) { if (n->GetKind() == Track::Wave) {
//printf("Checking to see if we need to pre-clear the track\n"); bPastedSomething |= ((WaveTrack *)n)->ClearAndPaste(t0, t1, c, true, true);
if (!((WaveTrack *) n)->IsEmpty(t0, t1)) {
((WaveTrack *) n)->Clear(t0, t1);
}
bPastedSomething |= ((WaveTrack *)n)->Paste(t0, c);
} }
else else
{ {
@ -4121,12 +4119,13 @@ void AudacityProject::OnPaste()
TrackListOfKindIterator clipWaveIter(Track::Wave, msClipboard); TrackListOfKindIterator clipWaveIter(Track::Wave, msClipboard);
c = clipWaveIter.Last(); c = clipWaveIter.Last();
while (n){ while (n) {
if (n->GetSelected() && n->GetKind()==Track::Wave){ if (n->GetSelected() && n->GetKind()==Track::Wave) {
if (c && c->GetKind() == Track::Wave){ if (c && c->GetKind() == Track::Wave) {
bPastedSomething |= bPastedSomething |=
((WaveTrack *)n)->ClearAndPaste(t0, t1, (WaveTrack *)c, true, true); ((WaveTrack *)n)->ClearAndPaste(t0, t1, (WaveTrack *)c, true, true);
}else{ }
else {
WaveTrack *tmp; WaveTrack *tmp;
tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate()); tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
bool bResult = tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct? bool bResult = tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct?
@ -4166,8 +4165,8 @@ void AudacityProject::OnPaste()
RedrawProject(); RedrawProject();
if (f) if (ff)
mTrackPanel->EnsureVisible(f); mTrackPanel->EnsureVisible(ff);
} }
} }