Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv12936/src

Modified Files:
        Menus.cpp 
Log Message:


Pasting behaviour changes


Index: Menus.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v
retrieving revision 1.396
retrieving revision 1.397
diff -u -d -r1.396 -r1.397
--- Menus.cpp   29 Jul 2008 15:41:24 -0000      1.396
+++ Menus.cpp   4 Aug 2008 15:02:41 -0000       1.397
@@ -2825,22 +2825,25 @@
    Track *f = NULL;
    
    bool pastedSomething = false;
+   bool trackTypeMismatch = false;
+   double srcLength = c->GetEndTime();
 
    while (n && c) {
       if (n->GetSelected()) {
          // When trying to copy from stereo to mono track, show error and exit
          // TODO: Automatically offer user to mix down to mono (unfortunately
          //       this is not easy to implement
-         if (c->GetLinked() && !n->GetLinked())
-         {
+         if (c->GetKind() != n->GetKind()){
             wxMessageBox(
-               _("Copying stereo audio into a mono track is not allowed."),
+               _("Pasting from one type of track into another is not 
allowed."),
                _("Error"), wxICON_ERROR, this);
+            trackTypeMismatch = true;
             break;
          }
-         if (c->GetKind() != n->GetKind()){
+         if (c->GetLinked() && !n->GetLinked())
+         {
             wxMessageBox(
-               _("Pasting from one type of track into another is not 
allowed."),
+               _("Copying stereo audio into a mono track is not allowed."),
                _("Error"), wxICON_ERROR, this);
             break;
          }
@@ -2893,6 +2896,28 @@
       n = iter.Next();
    }
    
+   if ( IsSticky() && ( (n && !c) || trackTypeMismatch ) ){
+      WaveTrack *tmp;
+      c = clipIter.First();
+      if (c->GetKind() != Track::Wave){
+         while(c && c->GetKind() != Track::Wave)
+            c = clipIter.Next();
+      }
+      
+      while (n){
+         if (n->GetSelected() && n->GetKind()==Track::Wave){
+            if (c && c->GetKind() == Track::Wave){
+               tmp = (WaveTrack*)c;
+            }else{
+               tmp = mTrackFactory->NewWaveTrack( 
((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
+               tmp->InsertSilence(0.0, srcLength);
+               tmp->Flush();
+            }
+            ((WaveTrack *)n)->HandlePaste(t0, tmp);
+         }
+         n = iter.Next();
+      }
+   }
    // TODO: What if we clicked past the end of the track?
 
    if (pastedSomething)


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to