Package de.sciss.app

Examples of de.sciss.app.AbstractCompoundEdit


      return DONE;
    } // run

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

      if( context.getReturnCode() == DONE ) {
        edit.perform();
        edit.end();
        getUndoManager().addEdit( edit );
      } else {
        edit.cancel();
      }
    }
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
      System.err.println( e1 );
      ce.cancel();
      return;
    }
    finally {
      doc.markers.editEnd( ce );
    }
    ce.perform();
    ce.end();
    doc.getUndoManager().addEdit( ce );
  }
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.getFrame().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

    final Span          union    = fullScale.getSpan();
    final Span          extSpan;
    final long          fullrateStop, fullrateLen; // , insertLen;
    final int          numFullBuf;
    // final CacheManager cm = CacheManager.getInstance();
    final AbstractCompoundEdit  ce      = null; // XXX
    final Object        source    = null; // XXX
    final AudioStake      cacheReadAS;
    final AudioStake      cacheWriteAS;

    synchronized( fileSync ) {
View Full Code Here

    public void actionPerformed( ActionEvent e )
    {
      SessionObject      so;
      int            i, num;
      AbstractCompoundEdit  edit;
      String          name;
      List          coll, coll2;
      Object[]        args;

      if( e.getSource() == ggName ) {
        coll  = scSel.getAll();
        coll2  = scAll.getAll();
        num    = coll.size();
        if( num == 0 ) return;
       
        args  = new Object[ 3 ];
       
        coll2.removeAll( coll );
        edit  = new BasicCompoundEdit();
        name  = ggName.getText();
        if( num == 1 ) {
          if( BasicSessionCollection.findByName( coll2, name ) != null ) {
            Session.makeNamePattern( name, args );
            name = BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN, args, coll2 );
          }
          edit.addPerform( new EditSetSessionObjectName( this, (SessionObject) coll.get( 0 ),
                                                         name ));
        } else {
          Session.makeNamePattern( name, args );
          for( i = 0; i < num; i++ ) {
            so    = (SessionObject) coll.get( i );
            name  = BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN, args, coll2 );
            edit.addPerform( new EditSetSessionObjectName( this, so, name ));
            coll2.add( so );
          }
        }
        edit.perform();
        edit.end();
        doc.getUndoManager().addEdit( edit );
      }
    }
View Full Code Here

      String          name;
      boolean          b1;
      int            result;
      List          collSO;
      SessionGroup      group;
      AbstractCompoundEdit  ce;

      try {
        doc.bird.waitShared( Session.DOOR_TRNS | Session.DOOR_RCV );
        b1 = doc.getSelectedReceivers().isEmpty() && doc.getSelectedTransmitters().isEmpty();
      } finally {
        doc.bird.releaseShared( Session.DOOR_TRNS | Session.DOOR_RCV );
      }
      if( b1 ) {  // ask if we should create an empty group
        result = JOptionPane.showConfirmDialog( null,
          AbstractApplication.getApplication().getResourceString( "warnNoObjectsSelected" ),
          getValue( Action.NAME ).toString(), JOptionPane.YES_NO_OPTION );
         
        if( result != JOptionPane.YES_OPTION ) return;
      }

      try {
        doc.bird.waitShared( Session.DOOR_GRP );
        name = BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN,
          new Object[] { new Integer( 1 ), Session.GRP_NAME_PREFIX, Session.GRP_NAME_SUFFIX },
          doc.getGroups().getAll() );
      } finally {
        doc.bird.releaseShared( Session.DOOR_GRP );
      }
      name = JOptionPane.showInputDialog( null, AbstractApplication.getApplication().getResourceString(
        "inputDlgNewGroup" ), name );
       
      if( name == null ) return;
     
      ce = new BasicCompoundEdit( getValue( NAME ).toString() );
     
      try {
        doc.bird.waitExclusive( Session.DOOR_GRP );
        group  = (SessionGroup) doc.getGroups().findByName( name );
        b1    = group == null;
        if( !b1 ) {
          result = JOptionPane.showConfirmDialog( null,
            AbstractApplication.getApplication().getResourceString(
            "optionDlgOverwriteGroup" ), getValue( Action.NAME ).toString(),
            JOptionPane.YES_NO_OPTION );
           
          if( result != JOptionPane.YES_OPTION ) return;
        } else {
          group = new BasicSessionGroup( doc );
          group.setName( name );
          doc.getGroups().getMap().copyContexts( this, MapManager.Context.FLAG_DYNAMIC,
                            MapManager.Context.NONE_EXCLUSIVE, group.getMap() );
        }
        if( !doc.bird.attemptShared( Session.DOOR_TRNS | Session.DOOR_RCV, 250 )) return;
        try {
          collSO    = doc.getSelectedReceivers().getAll();
          final List collGroup = Collections.singletonList( group );
          for( int i = 0; i < collSO.size(); i++ ) {
            final GroupableSessionObject so = (GroupableSessionObject) collSO.get( i );
            ce.addPerform( new EditAddSessionObjects( this, so.getGroups(), collGroup ));
          }
//          ce.addEdit( new EditAddSessionObjects( this, group.getReceivers(), collSO ));
          collSO    = doc.getSelectedTransmitters().getAll();
          for( int i = 0; i < collSO.size(); i++ ) {
            final GroupableSessionObject so = (GroupableSessionObject) collSO.get( i );
            ce.addPerform( new EditAddSessionObjects( this, so.getGroups(), collGroup ));
          }
//          ce.addEdit( new EditAddSessionObjects( this, group.getTransmitters(), collSO ));

          if( b1 ) {
            ce.addPerform( new EditAddSessionObjects( this, doc.getMutableGroups(), collGroup ));
          }
          ce.perform();
          ce.end();
          doc.getUndoManager().addEdit( ce );
         
        } finally {
          doc.bird.releaseShared( Session.DOOR_TRNS | Session.DOOR_RCV );
        }
View Full Code Here

      }
    } // run()

    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

     
      if( numFrames < 0 ) throw new IllegalArgumentException( String.valueOf( numFrames ));
      if( (pos < 0) || (pos > timeline.getLength()) ) throw new IllegalArgumentException( String.valueOf( pos ));

      final ProcessingThread     proc;
      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() ));
      }

      proc.putClientArg( "tis", Track.getInfos( selectedTracks.getAll(), tracks.getAll() ));
      proc.putClientArg( "edit", edit );
      proc.putClientArg( "span", insertSpan );
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.