Package de.sciss.app

Examples of de.sciss.app.PerformableEdit


    TableLookupReceiver  rcv    = (TableLookupReceiver) this.rcv;
    float[]        distTab = null;
    float[]        rotTab  = null;
    Span        distSpan= null;
    Span        rotSpan = null;
    PerformableEdit    edit;
   
    if( doc == null || rcv == null ) return;
   
    if( !doc.bird.attemptExclusive( Session.DOOR_RCV, 200 )) return;
    try {
      if( e.getSource() == distanceEditor ) {
        distTab = distanceEditor.getVector();
        distSpan= (Span) e.getActionObject();
      } else if( e.getSource() == rotationEditor ) {
        rotTab  = rotationEditor.getVector();
        rotSpan = (Span) e.getActionObject();
      } else {
        assert false : e.getSource();
      }
      edit = new EditTableLookupRcvSense( this, doc, rcv, distTab, distSpan,
                                 rotTab, rotSpan );
      doc.getUndoManager().addEdit( edit.perform() );
    }
    catch( IOException e1 ) {
      System.err.println( e1.getLocalizedMessage() );
      setVectors();   // undo edits
    }
View Full Code Here


   *
   *  @synchronization  waitExclusive on DOOR_RCV
   */
  private void editSelectAll()
  {
    final PerformableEdit edit;
 
    try {
      doc.bird.waitExclusive( Session.DOOR_RCV );
      edit = new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), doc.getMutableReceivers().getAll() );
      doc.getUndoManager().addEdit( edit.perform() );
    }
    finally {
      doc.bird.releaseExclusive( Session.DOOR_RCV );
    }
  }
View Full Code Here

      double      distanceSq;
      double      hitDistSq    = 51.0;    // Mouse must be as close at 5 pixels delta-h and delta-v
      Receiver    hitReceiver    = null;
      int        i;
      List       coll;
      PerformableEdit  edit;
      List      collRcv;

      e.getComponent().requestFocus()// otherwise keyboard shortcuts etc. don't work

      if( !doc.bird.attemptShared( Session.DOOR_RCV | Session.DOOR_GRP, 250 )) return;
      try {
        collRcv = doc.getActiveReceivers().getAll();
        for( i = 0; i < collRcv.size(); i++ ) {
          rcv = (Receiver) collRcv.get( i );
          ptReceiver = rcv.getAnchor();
          ptReceiverTrns = virtualToScreen( ptReceiver );
          distanceSq = ptReceiverTrns.distanceSq( ptMouse );
          if( distanceSq < hitDistSq ) {
            hitDistSq   = distanceSq;
            hitReceiver  = rcv;
          }
        }

        // prepare DnD
        if( hitReceiver != null ) {
          dndFirstEvent   = e;    // mouseDragged() will detect this
          dndDragging    = false// a follow-up mouse move is still required to start the drag
        } else {
          dndFirstEvent   = null;
        }

        // manage (de)selection
        if( e.isShiftDown() || e.isMetaDown() ) {    // multi-selection by holding down the shift or cmd key
          if( hitReceiver != null ) {          // selection changed indeed
            coll = doc.getSelectedReceivers().getAll();
            if( !coll.contains( hitReceiver )) {  // add object to selection
              coll.add( hitReceiver );
            } else {                // remove object from selection
              coll.remove( hitReceiver );
            }
            edit = new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), coll );
            doc.getUndoManager().addEdit( edit.perform() );
            updateReceiverShapes();
            redrawImage();
            repaint( virtualToScreenClip( hitReceiver.getBounds() ));
          }
        } else {        // single-selection
          coll = doc.getSelectedReceivers().getAll();
          if( (hitReceiver == null && !coll.isEmpty()) ||
            (hitReceiver != null && !coll.contains( hitReceiver ))) {  // selection changed indeed
           
            clipRect = getUnionRect( coll );
            coll.clear();
            if( hitReceiver != null ) {
              coll.add( hitReceiver );
              clipRect2 = hitReceiver.getBounds();
            } else {
              clipRect2 = null;
            }
            edit = new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), coll );
            doc.getUndoManager().addEdit( edit.perform() );
            updateReceiverShapes();
            redrawImage();
            efficientUpdateAndRepaint( clipRect, clipRect2, false );
          }
        }
View Full Code Here

      Receiver    rcv;
      Rectangle2D    clipRect;
      ReceiverEditor  rcvEdit;
      AbstractWindow  rcvEditFrame;
      List      coll;
      PerformableEdit  edit;

      if( !doc.bird.attemptShared( Session.DOOR_RCV, 250 )) return;
      try {
        if( doc.getSelectedReceivers().isEmpty() ) {
          if( e.getClickCount() == 2 ) {  // double click creates new Receiver
            rcv = createReceiver( screenToVirtual( e.getPoint() ));
            if( rcv != null ) {
              coll = doc.getSelectedReceivers().getAll();
              coll.add( rcv );
              edit = new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), coll );
              doc.getUndoManager().addEdit( edit.perform() );
              clipRect = rcv.getBounds();
              updateSurfacePaneImage( clipRect );
              updateReceiverShapes();
              redrawImage();
              repaint( virtualToScreenClip( clipRect ));
View Full Code Here

      Point2D      ptMouseTrns, ptAnchor;
      Rectangle2D    dndCurrentRect;
      int        i;
      Receiver    rcv;
      List      dndColl;
      PerformableEdit  edit;
     
      if( !dndDragging ) {  // test if mouse move was sufficient
        if( ptDeltaMouse.getX()*ptDeltaMouse.getX()+ptDeltaMouse.getY()*ptDeltaMouse.getY() <= 25.0 ) return;
      }

      dndColl = doc.getSelectedReceivers().getAll();
      if( !dndDragging ) {
        dndDragging    = true;
        dndRecentRect   = getUnionRect( dndColl );
        dndAnchorRef.clear();
        for( i = 0; i < dndColl.size(); i++ ) {
          rcv = (Receiver) dndColl.get( i );
          dndAnchorRef.put( rcv, rcv.getAnchor() );
        }
      }
//      ptMouseTrns = screenToVirtual( ptDeltaMouse );
      final Point2D ptTrns1 = screenToVirtual( dndFirstEvent.getPoint() );
      final Point2D ptTrns2 = screenToVirtual( e.getPoint() );
      ptMouseTrns = new Point2D.Double( ptTrns2.getX() - ptTrns1.getX(),
                                        ptTrns2.getY() - ptTrns1.getY() );
     
      for( i = 0; i < dndColl.size(); i++ ) {
        rcv      = (Receiver) dndColl.get( i );
        ptAnchor  = (Point2D) dndAnchorRef.get( rcv );
        if( ptAnchor != null ) {
// XXX need to exclude our own anchor in the snap method() !
//            rcv.setAnchor( snap( new Point2D.Double(
//              Math.max( 0.0, Math.min( 1.0, ptAnchor.getX() + ptMouseTrns.getX() )),
//              Math.max( 0.0, Math.min( 1.0, ptAnchor.getY() + ptMouseTrns.getY() ))), true ));
          ptAnchor = new Point2D.Double(
            Math.max( -1.0, Math.min( 1.0, ptAnchor.getX() + ptMouseTrns.getX() )),
            Math.max( -1.0, Math.min( 1.0, ptAnchor.getY() + ptMouseTrns.getY() )));
          edit   = new EditSetReceiverAnchor( this, doc, rcv, ptAnchor );
         
//System.out.println( "ptDeltaMouse = " + ptDeltaMouse + "; ptMouseTrns = " + ptMouseTrns + "; ptAnchor = " + ptAnchor );
         
          doc.getUndoManager().addEdit( edit.perform() );
        }
      }
      dndCurrentRect  = getUnionRect( dndColl );
      updateReceiverShapes();
      efficientUpdateAndRepaint( dndRecentRect, dndCurrentRect, true );
View Full Code Here

      doc.getReceivers().getMap().copyContexts( this, MapManager.Context.FLAG_DYNAMIC,
                         MapManager.Context.NONE_EXCLUSIVE, rcv.getMap() );         
      collNewRcv = Collections.singletonList( rcv );

      if( doc.getSelectedGroups().isEmpty() ) {
        final PerformableEdit edit;
        edit  = new EditAddSessionObjects( this, doc.getMutableReceivers(), collNewRcv );
        doc.getUndoManager().addEdit( edit.perform() );
      } else {
        final AbstractCompoundEdit edit;
        edit  = new BasicCompoundEdit();
        final List selectedGroups = doc.getSelectedGroups().getAll();
        for( int i = 0; i < collNewRcv.size(); i++ ) {
          final GroupableSessionObject so = (GroupableSessionObject) collNewRcv.get( i );
          edit.addPerform( new EditAddSessionObjects( this, so.getGroups(), selectedGroups ));
        }
        edit.addPerform( new EditAddSessionObjects( this, doc.getMutableReceivers(), collNewRcv ));
//        for( i = 0; i < doc.getSelectedGroups().size(); i++ ) {
//          group  = (SessionGroup) doc.getSelectedGroups().get( i );
//          edit.addPerform( new EditAddSessionObjects( this, group.getReceivers(), collRcv ));
//        }
        edit.perform();
        edit.end();
        doc.getUndoManager().addEdit( edit );
      }
    }
    catch( InstantiationException e1 ) {
      System.err.println( e1.getLocalizedMessage() );
View Full Code Here

TOP

Related Classes of de.sciss.app.PerformableEdit

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.