Package de.sciss.eisenkraut.edit

Examples of de.sciss.eisenkraut.edit.BasicCompoundEdit


      long      pos;
   
      selSpan    = getSelectionSpan();
      if( selSpan.isEmpty() ) return;
     
      edit  = new BasicCompoundEdit();
      if( deselect ) edit.addEdit( TimelineVisualEdit.select( this, doc, new Span() ).perform() );
      pos    = (long) (selSpan.getStart() + selSpan.getLength() * weight + 0.5);
      edit.addEdit( TimelineVisualEdit.position( this, doc, pos ).perform() );
      edit.end();
      doc.getUndoManager().addEdit( edit );
View Full Code Here


    final Span        span  = source.context.getTimeSpan();
   
//    consc.edit    = new SyncCompoundSessionObjEdit(
//      this, doc.bird, Session.DOOR_ALL, context.getTracks(),
//      AudioTrack.OWNER_WAVE, null, null, consc.plugIn.getName() );
    consc.edit    = new BasicCompoundEdit( consc.plugIn.getName() );
   
//    consc.bc    = BlendingAction.createBlendContext(
//      AbstractApplication.getApplication().getUserPrefs().node( BlendingAction.DEFAULT_NODE ),
//      context.getSourceRate(), context.getTimeSpan().getLength() / 2, context.getTimeSpan().getLength() / 2 ); // XXXXXXX
View Full Code Here

      insertSpan      = new Span( insertPos, insertPos + pasteLength );
      copySpan      = new Span( tl.getSpan().start, tl.getSpan().start + pasteLength );
      cutTimeline      = (mode == EDIT_INSERT) && !hasSelectedAudio.isSet();
      cutTimelineSpan    = cutTimeline ? new Span( docLength, docLength + pasteLength ) : null;
     
      edit      = new BasicCompoundEdit( procName );
      oldSelSpan    = timeline.getSelectionSpan();
      if( !oldSelSpan.isEmpty() ) { // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
      }
View Full Code Here

    }
   
    protected void perform()
    {
      final Span            selSpan, deleteBefore, deleteAfter;
      final BasicCompoundEdit    edit;
      final List            tis;
      Track.Info            ti;
      boolean              success  = false;

      edit      = new BasicCompoundEdit( getValue( NAME ).toString() );
     
      try {
        selSpan      = timeline.getSelectionSpan();
//        if( selSpan.isEmpty() ) return;
        tis        = Track.getInfos( selectedTracks.getAll(), tracks.getAll() );
        deleteBefore  = new Span( 0, selSpan.start );
        deleteAfter    = new Span( selSpan.stop, timeline.getLength() );

        // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
        edit.addPerform( TimelineVisualEdit.position( this, Session.this, 0 ));

        if( !deleteAfter.isEmpty() || !deleteBefore.isEmpty() ) {
          for( int i = 0; i < tis.size(); i++ ) {
            ti = (Track.Info) tis.get( i );
            ti.trail.editBegin( edit );
            try {
              if( !deleteAfter.isEmpty() ) ti.trail.editRemove( this, deleteAfter, edit );
              if!deleteBefore.isEmpty() ) ti.trail.editRemove( this, deleteBefore, edit );
            }
            finally {
              ti.trail.editEnd( edit );
            }
          }
        }

        edit.addPerform( new EditSetTimelineLength( this, Session.this, selSpan.getLength() ));
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, selSpan.shift( -selSpan.start )));

        edit.perform();
        edit.end();
        getUndoManager().addEdit( edit );
        success = true;
      }
      finally {
        if( !success ) edit.cancel();
      }
    }
View Full Code Here

      final AbstractCompoundEdit  edit;
      final Span          oldSelSpan, insertSpan;

      proc = new ProcessingThread( this, getFrame(), getValue( NAME ).toString() );

      edit    = new BasicCompoundEdit( proc.getName() );
      oldSelSpan  = timeline.getSelectionSpan();
      insertSpan  = new Span( pos, pos + numFrames );

      if( !oldSelSpan.isEmpty() ) { // deselect
        edit.addPerform( TimelineVisualEdit.select( this, Session.this, new Span() ));
View Full Code Here

         */
        maxLen        = cutLength >> 1;
        bc          = createBlendContext( maxLen, 0, hasSelectedAudio.isSet() );
      }
//      bc          = createBlendContext( Math.min( cutLength, span.start ), Math.min( cutLength, docLength - span.stop ), hasSelectedAudio );
      edit        = new BasicCompoundEdit( procName );

//      if( bc != null )  System.out.println( "bc  : " + bc.getLen() + ", " + bc.getLeftLen() + ", "+ bc.getRightLen() );
     
      cutTimeline      = (mode == EDIT_INSERT) && hasSelectedAudio.isSet();
      newDocLength    = cutTimeline ? docLength - cutLength : docLength;
View Full Code Here

  public void oscCmd_add( RoutedOSCMessage rom )
  {
    final int          num      = rom.msg.getArgCount() >> 1;
    if( num == 0 ) return;
//    final long          timelineLen  = doc.timeline.getLength();  // XXX sync
    final BasicCompoundEdit    ce;
    final List          coll    = new ArrayList( num );
    int              argIdx    = 1;
    long            pos;
    String            name;
   
   
    try {
      for( int i = 0; i < num; i++ ) {
        pos    = Math.max( 0, ((Number) rom.msg.getArg( argIdx )).longValue() );
        argIdx++;
        name  = rom.msg.getArg( argIdx ).toString();
        argIdx++;
        coll.add( new MarkerStake( pos, name ));
      }
      ce = new BasicCompoundEdit( getResourceString( num > 1 ? "editAddMarkers" : "editAddMarker" ));
      trail.editBegin( ce );
      try {
        trail.editAddAll( this, coll, ce );
      }
      finally {
        trail.editEnd( ce );
      }
      ce.perform();
      ce.end();
      doc.getUndoManager().addEdit( ce );
    }
    catch( ClassCastException e1 ) {
      OSCRoot.failedArgType( rom, argIdx );
    }
View Full Code Here

   [ &lt;address&gt;, "remove", "at", [ &lt;(int) idx&gt; ] * N ]
   *  </pre>
   */
  public void oscCmd_remove( RoutedOSCMessage rom )
  {
    final BasicCompoundEdit  ce;
    final List          coll;
    final long          n1, n2;
    int              i1, i2;
    int              argIdx    = 1;
   
    try {
      if( rom.msg.getArg( argIdx ).equals( "span" )) {
        argIdx++;
        n1    = ((Number) rom.msg.getArg( argIdx )).longValue();
        argIdx++;
        n2    = ((Number) rom.msg.getArg( argIdx )).longValue();
        coll  = trail.getRange( new Span( n1, n2 ), true );
       
      } else if( rom.msg.getArg( argIdx ).equals( "range" )) {
        argIdx++;
        i1    = Math.max( 0, ((Number) rom.msg.getArg( argIdx )).intValue() );
        argIdx++;
        i2    = Math.min( trail.getNumStakes(), ((Number) rom.msg.getArg( argIdx )).intValue() );
        coll  = new ArrayList( Math.max( 1, i2 - i1 ));
        while( i1 < i2 ) {
          coll.add( trail.get( i1++ ));
        }

      } else if( rom.msg.getArg( argIdx ).equals( "at" )) {
        argIdx++;
        coll = new ArrayList( rom.msg.getArgCount() - argIdx );
        for( ; argIdx < rom.msg.getArgCount(); argIdx++ ) {
          i1  = ((Number) rom.msg.getArg( argIdx )).intValue();
          if( (i1 >= 0) && (i1 < trail.getNumStakes()) ) {
            coll.add( trail.get( i1 ));
          }
        }
     
      } else {
        OSCRoot.failedArgValue( rom, argIdx );
        return;
      }

      if( coll.isEmpty() ) return;

      ce = new BasicCompoundEdit( getResourceString( coll.size() > 1 ? "editDeleteMarkers" : "editDeleteMarker" ));
      trail.editBegin( ce );
      try {
        trail.editRemoveAll( this, coll, ce );
      }
      finally {
        trail.editEnd( ce );
      }
      ce.perform();
      ce.end();
      doc.getUndoManager().addEdit( ce );
    }
    catch( IndexOutOfBoundsException e1 ) {
      OSCRoot.failedArgCount( rom );
    }
View Full Code Here

  public void addMarker( long pos )
  {
    final AbstractCompoundEdit  ce;
 
    pos    = Math.max( 0, Math.min( doc.timeline.getLength(), pos ));
    ce    = new BasicCompoundEdit( getResourceString( "editAddMarker" ));
    doc.markers.editBegin( ce );
    try {
      doc.markers.editAdd( this, new MarkerStake( pos, "Mark" ), ce );
    }
    catch( IOException e1 ) {  // should never happen
View Full Code Here

 
    mark  = getMarkerLeftTo( pos );
    pos    = Math.max( 0, Math.min( doc.timeline.getLength(), pos ));
    if( mark == null ) return;
   
    ce    = new BasicCompoundEdit( getResourceString( "editDeleteMarker" ));
    doc.markers.editBegin( ce );
    try {
      doc.markers.editRemove( this, mark, ce );
    }
    catch( IOException e1 ) {  // should never happen
View Full Code Here

TOP

Related Classes of de.sciss.eisenkraut.edit.BasicCompoundEdit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.