Package de.sciss.app

Examples of de.sciss.app.AbstractCompoundEdit


     */
    public int processRun( ProcessingThread context )
    throws IOException
    {
      final List          tis      = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );
      Track.Info          ti;
      AudioTrail          audioTrail;

      for( int i = 0; i < tis.size(); i++ ) {
View Full Code Here


      return DONE;
    }

    public void processFinished( ProcessingThread context )
    {
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );

      if( context.getReturnCode() == DONE ) {
        if( !insertSpan.isEmpty() ) {  // adjust timeline
          edit.addPerform( new EditSetTimelineLength( this, Session.this, timeline.getLength() + insertSpan.getLength() ));
          if( timeline.getVisibleSpan().isEmpty() ) {
            edit.addPerform( TimelineVisualEdit.scroll( this, Session.this, insertSpan ));
          }
        }
        if( !insertSpan.isEmpty() ) {
          edit.addPerform( TimelineVisualEdit.select( this, Session.this, insertSpan ));
          edit.addPerform( TimelineVisualEdit.position( this, Session.this, insertSpan.stop ));
        }
        edit.perform();
        edit.end();
        getUndoManager().addEdit( edit );
      } else {
        edit.cancel();
      }
    }
View Full Code Here

//                                   ctrlPoints, Session.DOOR_TIMETRNSMTE );
    final Span span    = doc.timeline.getSelectionSpan();
    final List collTrns  = doc.getSelectedTransmitters().getAll();
    if( span.isEmpty() || collTrns.isEmpty() ) return;

    final AbstractCompoundEdit edit;
    edit = new CompoundSessionObjEdit( this, collTrns, Transmitter.OWNER_TRAJ,
                                       null, null, "Geometric Tool" );

    renderThread = new ProcessingThread( this, root,
        AbstractApplication.getApplication().getResourceString( "toolWriteTransmitter" ));
View Full Code Here

   *            the processing argument.
   */
  public int processRun( ProcessingThread context ) throws IOException
  {
    final Span            span    = (Span) context.getClientArg( "span" );
    final AbstractCompoundEdit    edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
    final List            collTrns  = (List) context.getClientArg( "trns" );
    final BlendContext        bc      = (BlendContext) context.getClientArg( "blend" );
    final float[][]          srcBuf    = bc == null ? null : new float[ 2 ][ 4096 ];
    final float[][]          interpBuf;
    Transmitter            trns;
View Full Code Here

   *  Invoked by the <code>ProcessingThread</code> upon
   *  processing completion. This implementation does not nothing
   */
  public void processFinished( ProcessingThread context )
  {
    final AbstractCompoundEdit edit = (AbstractCompoundEdit) context.getClientArg( "edit" );
   
    if( context.getReturnCode() == ProgressComponent.DONE ) {
      edit.perform();
      edit.end(); // fires doc.tc.modified()
      doc.getUndoManager().addEdit( edit );
    } else {
      edit.cancel();
    }
  }
View Full Code Here

    Receiver            rcv, rcv2;
    Transferable          o;
    Point2D              pt, pt2;
    boolean              success  = false;
    boolean              retry;
    AbstractCompoundEdit      edit;
    Object[]            args;
    final Application        app    = AbstractApplication.getApplication();
 
    try {
      t = app.getClipboard().getContents( this );
      if( t == null ) return false;
     
      if( t.isDataFlavorSupported( TransferableCollection.collectionFlavor )) {
        coll = (java.util.List) t.getTransferData( TransferableCollection.collectionFlavor );
      } else if( t.isDataFlavorSupported( Receiver.receiverFlavor )) {
        rcv = (Receiver ) t.getTransferData( Receiver.receiverFlavor );
        coll = new Vector( 1 );
        coll.add( rcv );
      } else {
        return false;
      }

      try {
        args = new Object[ 3 ];
       
        doc.bird.waitExclusive( Session.DOOR_RCV | Session.DOOR_GRP );
        coll2   = doc.getReceivers().getAll();
        coll3  = new ArrayList( coll2 );
        for( int i = 0; i < coll.size(); i++ ) {
          o = (Transferable) coll.get( i );
          if( o.isDataFlavorSupported( Receiver.receiverFlavor )) {
            rcv = (Receiver) o.getTransferData( Receiver.receiverFlavor );
            do {
              retry = false;
              for( int j = 0; j < coll3.size(); j++ ) {
                rcv2 = (Receiver) coll3.get( j );
                pt = rcv.getAnchor();
                if( pt.distance( rcv2.getAnchor() ) < 0.05 ) {
                  pt2 = new Point2D.Double( Math.min( 1.0, pt.getX() + 0.05 ),
                                Math.min( 1.0, pt.getY() + 0.05 ));
                  rcv.setAnchor( pt2 );
                  if( pt2.distance( pt ) > 0.05 ) retry = true;
                }
              }
            } while( retry );
            coll3.add( rcv );
          }
        } // for( i = 0; i < coll.size(); i++ )
        coll3.removeAll( coll2 ); // now only the new ones remain

        // ensure unique names
        for( int i = 0; i < coll3.size(); i++ ) {
          rcv = (Receiver) coll3.get( i );
          if( doc.getReceivers().findByName( rcv.getName() ) != null ) {
            Session.makeNamePattern( rcv.getName(), args );
            rcv.setName( BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN, args, coll2 ));
          }
          coll2.add( rcv );
        }
       
        if( !coll3.isEmpty() ) {
          edit = new BasicCompoundEdit();
          final List selectedGroups = doc.getSelectedGroups().getAll();
          if( !selectedGroups.isEmpty() ) {
            for( int i = 0; i < coll3.size(); i++ ) {
              final GroupableSessionObject so = (GroupableSessionObject) coll3.get( i );
              edit.addPerform( new EditAddSessionObjects( this, so.getGroups(), selectedGroups ));
            }
          }
          edit.addPerform( new EditAddSessionObjects( this, doc.getMutableReceivers(), coll3 ));
//          for( int i = 0; i < doc.getSelectedGroups().size(); i++ ) {
//            group  = (SessionGroup) doc.getSelectedGroups().get( i );
//            edit.addPerform( new EditAddSessionObjects( this, group.getReceivers(), coll3 ));
//          }

          edit.addPerform( new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), coll3 ));
          edit.perform();
          edit.end();
          doc.getUndoManager().addEdit( edit );
        }
       
        success = true;
      }
View Full Code Here

     @synchronization  waitExclusive on DOOR_TIME
     */
    public void actionPerformed( ActionEvent e )
    {
      Span          span;
      AbstractCompoundEdit  edit;
   
      try {
        doc.bird.waitExclusive( Session.DOOR_TIME );
        span  = doc.timeline.getSelectionSpan();
        if( span.isEmpty() || span.getStart() == 0 ) return;
        span  = new Span( Math.max( 0, span.getStart() + 1 - span.getLength() ), span.getStart() + 1 );

        edit  = new BasicCompoundEdit( getValue( NAME ).toString() );
        edit.addPerform( TimelineVisualEdit.select( this, doc, span ));
        edit.addPerform( TimelineVisualEdit.position( this, doc, span.getStart() ));
        edit.perform();
        edit.end();
        doc.getUndoManager().addEdit( edit );
      }
      finally {
        doc.bird.releaseExclusive( Session.DOOR_TIME );
      }
View Full Code Here

    doc.getUndoManager().addEdit( ce );
  }
 
  private void removeMarkerLeftTo( long pos )
  {
    final AbstractCompoundEdit  ce;
    final MarkerStake    mark;
 
    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
      System.err.println( e1 );
      ce.cancel();
      return;
    }
    finally {
      doc.markers.editEnd( ce );
    }
    ce.perform();
    ce.end();
    doc.getUndoManager().addEdit( ce );
  }
View Full Code Here

  {
    final MarkerStake mark = doc.markers.get( editIdx );
    if( mark == null ) return;

    final long        positionSmps;
    final AbstractCompoundEdit  ce;

    positionSmps  = (long) timeTrans.translate( ggMarkPos.getValue(), ParamSpace.spcTimeSmps ).val;
    if( (positionSmps == mark.pos) && (ggMarkName.getText().equals( mark.name ))) return; // no change
   
    ce    = new BasicCompoundEdit( getResourceString( "editEditMarker" ));
    doc.markers.editBegin( ce );
    try {
      doc.markers.editRemove( this, mark, ce );
      doc.markers.editAdd( this, new MarkerStake( positionSmps, ggMarkName.getText() ), ce );
    }
    catch( IOException e1 ) {  // should never happen
      System.err.println( e1 );
      ce.cancel();
      return;
    }
    finally {
      doc.markers.editEnd( ce );
    }
    ce.perform();
    ce.end();
    doc.getUndoManager().addEdit( ce );
  }
View Full Code Here

    }
  }

  public void mouseReleased( MouseEvent e )
  {
    AbstractCompoundEdit ce;
 
    if( adjustCatchBypass ) {
      adjustCatchBypass = false;
      doc.getTimelineFrame().removeCatchBypass();
    }
   
    try {
      if( dragLastMark != null ) {
//        if( !doc.bird.attemptExclusive( Session.DOOR_TIME, 250 )) return;
//        try {
          // ok this is tricky and totally stupid, have to replace it some day XXX
//          doc.markers.remove( this, dragLastMark );  // remove temporary marker
//          doc.markers.add( this, dragMark );      // restore original marker for undoable edit!
          ce  = new BasicCompoundEdit( getResourceString( "editMoveMarker" ));
          doc.markers.editBegin( ce );
          try {
            doc.markers.editRemove( this, dragMark, ce );
            doc.markers.editAdd( this, dragLastMark, ce );
          }
          catch( IOException e1 ) {  // should never happen
            System.err.println( e1 );
            ce.cancel();
            return;
          }
          doc.markers.editEnd( ce );
          ce.perform();
          ce.end();
          doc.getUndoManager().addEdit( ce );
//        }
//        catch( IOException e1 ) {  // should never happen
//          System.err.println( e1 );
//          return;
View Full Code Here

TOP

Related Classes of de.sciss.app.AbstractCompoundEdit

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.