From: <aki...@us...> - 2006-12-16 22:38:19
|
Revision: 1116 http://svn.sourceforge.net/gridarta/?rev=1116&view=rev Author: akirschbaum Date: 2006-12-16 14:38:19 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Replace redundant variable. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CopyBuffer.java Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-16 21:30:26 UTC (rev 1115) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-16 22:38:19 UTC (rev 1116) @@ -72,8 +72,6 @@ /** MapControl for {@link #copyMap}. */ @Nullable private MapControl copyMapCtrl; - private boolean empty; // Is the CopyBuffer empty? - /** The dummy MapArchObject of {@link #copyMap}. */ private final MapArchObject mapArch; @@ -86,7 +84,6 @@ * @param mainControl main control */ public CopyBuffer(final CMainControl mainControl) { - empty = true; // Buffer is empty this.mainControl = mainControl; // link main control in mapArch = new MapArchObject(); @@ -105,7 +102,7 @@ * <code>false</code> */ public boolean isEmpty() { - return empty; + return copyMap == null; } /** @@ -146,19 +143,18 @@ // Prepare the buffer (if it's a cut or copy) if (mode == Mode.DO_CUT || mode == Mode.DO_COPY) { - if (empty) { - empty = false; // from now on the buffer is never empty again - mainControl.getMainView().refreshMenus(); // "Paste" enabled - } + final boolean wasEmpty = copyMap == null; // recycle and resize buffer bufWidth = Math.abs(selRec.width) + 1; // new width bufHeight = Math.abs(selRec.height) + 1; // new height mapArch.setMapSize(new Size2D(bufWidth, bufHeight)); - copyMap = null; // free objects (at least that is the plan and theory) - copyMapCtrl = null; copyMap = new DefaultMapModel(mainControl, copyMapCtrl, null, mapArch); // new MapModel copyMapCtrl = new MapControl(mainControl, null, mapArch, false, null); // new MapControl + + if (wasEmpty) { + mainControl.getMainView().refreshMenus(); // "Paste" enabled + } } // cycle through all tile coordinates which are highlighted: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |