2c2 < * @(#)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 7a14,16 > import CH.ifa.draw.framework.*; > import CH.ifa.draw.standard.*; > import CH.ifa.draw.util.Undoable; 10,12c19 < import java.io.IOException; < import CH.ifa.draw.framework.*; < import CH.ifa.draw.standard.AbstractTool; --- > import java.util.Vector; 15a23 > * 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; > 29d44 < fScribble = null; 35c50 < if (fScribble.size().width < 4 || fScribble.size().height < 4) --- > if (fScribble.size().width < 4 || fScribble.size().height < 4) { 36a52,55 > // nothing to undo > setUndoActivity(null); > } > fScribble = null; 43,44c62,64 < view().add(fScribble); < } else if (fLastX != x || fLastY != y) --- > setAddedFigure(view().add(fScribble)); > } > else if (fLastX != x || fLastY != y) { 45a66 > } 53c74,79 < fScribble = null; --- > // use undo activity from paste command... > setUndoActivity(createUndoActivity()); > > // put created figure into a figure enumeration > getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); > 65c91 < 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()); > } > }