Exemple #1
0
  public void mousePressed(
      java.awt.event.MouseEvent ev,
      edu.cmu.cs.stage3.alice.core.Transformable pickedTransformable,
      edu.cmu.cs.stage3.alice.scenegraph.renderer.PickInfo pickInfo) {
    if (isButton1(ev)) {
      undoRedoStack.startCompound();
      if (pickedTransformable != null) {
        String name =
            edu.cmu.cs.stage3.alice.authoringtool.AuthoringToolResources.getNameForNewChild(
                pickedTransformable.name.getStringValue(), pickedTransformable.getParent());
        int index = pickedTransformable.getParent().getIndexOfChild(pickedTransformable) + 1;

        //				if( undoRedoStack != null ) {
        //					undoRedoStack.setIsListening( true ); // make the copy get automatically picked up by
        // the undoRedoStack
        //				}
        pickedTransformable =
            (edu.cmu.cs.stage3.alice.core.Transformable)
                pickedTransformable.HACK_createCopy(
                    name, pickedTransformable.getParent(), index, classesToShare, null);
        edu.cmu.cs.stage3.alice.authoringtool.AuthoringToolResources
            .addElementToAppropriateProperty(pickedTransformable, pickedTransformable.getParent());
        //				undoRedoStack.push( new
        // edu.cmu.cs.stage3.alice.authoringtool.util.PropertyUndoableRedoable(
        // pickedTransformable.vehicle, null, pickedTransformable.vehicle.get() ) );
        //				if( undoRedoStack != null ) {
        //					undoRedoStack.setIsListening( false );
        //				}
      }
      super.mousePressed(ev, pickedTransformable, pickInfo);
      hasBeenDragged = false;
    }
  }
Exemple #2
0
 public void mouseDragged(java.awt.event.MouseEvent ev, int dx, int dy) {
   if (isButton1(ev)) {
     super.mouseDragged(ev, dx, dy);
     hasBeenDragged = true;
   }
 }