2,2c2,2 < * @(#)ScribbleTool.java 5.2 --- > * @(#)ScribbleTool.java 3a4,9 > * Project: JHotdraw - a GUI framework for technical drawings > * http://www.jhotdraw.org > * http://jhotdraw.sourceforge.net > * Copyright: © by the original author(s) and all contributors > * License: Lesser GNU Public License (LGPL) > * http://www.opensource.org/licenses/lgpl-license.html 9a19,19 > import java.util.Vector; 10,10d13 < import java.io.IOException; 11,11c14,14 < import CH.ifa.draw.framework.*; --- > import CH.ifa.draw.framework.*; 12,12c15,15 < import CH.ifa.draw.standard.AbstractTool; --- > import CH.ifa.draw.standard.*; 12a16,16 > import CH.ifa.draw.util.Undoable; 15a23,23 > * 16a25,26 > * > * @version <$CURRENT_VERSION$> 22a33,38 > /** > * the figure that was actually added > * Note, this can be a different figure from the one which has been created. > */ > private Figure myAddedFigure; > 28a52,54 > // nothing to undo > setUndoActivity(null); > } 29,29c55,55 < fScribble = null; --- > fScribble = null; 35,35c50,50 < if (fScribble.size().width < 4 || fScribble.size().height < 4) --- > if (fScribble.size().width < 4 || fScribble.size().height < 4) { 42a62,63 > setAddedFigure(view().add(fScribble)); > } 43,43d61 < view().add(fScribble); 44,44c64,64 < } else if (fLastX != x || fLastY != y) --- > else if (fLastX != x || fLastY != y) { 45a66,66 > } 52a74,79 > // use undo activity from paste command... > setUndoActivity(createUndoActivity()); > > // put created figure into a figure enumeration > getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); > 53,53d73 < fScribble = null; 65,65c91,91 < if (fScribble != null) --- > if (fScribble != null) { 68a95,114 > > /** > * Gets the figure that was actually added > * Note, this can be a different figure from the one which has been created. > */ > protected Figure getAddedFigure() { > return myAddedFigure; > } > > private void setAddedFigure(Figure newAddedFigure) { > myAddedFigure = newAddedFigure; > } > > /** > * Factory method for undo activity > */ > protected Undoable createUndoActivity() { > return new PasteCommand.UndoActivity(view()); > } > }