From: <aki...@us...> - 2006-12-19 00:27:26
|
Revision: 1189 http://svn.sourceforge.net/gridarta/?rev=1189&view=rev Author: akirschbaum Date: 2006-12-18 16:27:26 -0800 (Mon, 18 Dec 2006) Log Message: ----------- Add "select all" to edit menu. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/ChangeLog 2006-12-19 00:27:26 UTC (rev 1189) @@ -1,5 +1,7 @@ 2006-12-19 Andreas Kirschbaum + * Add "select all" to edit menu. + * Properly enable/disable edit menu entries. 2006-12-18 Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-19 00:27:26 UTC (rev 1189) @@ -1783,6 +1783,9 @@ /** Action called for "floodfill". */ private final Action aFloodfill = ACTION_FACTORY.createAction(true, "floodfill", this); + /** Action called for "select all". */ + private final Action aSelectAll = ACTION_FACTORY.createAction(true, "selectAll", this); + /** * Create a new instance. * @@ -1806,6 +1809,7 @@ aRandFillAbove.setEnabled(isRandFillAboveEnabled()); aRandFillBelow.setEnabled(isRandFillBelowEnabled()); aFloodfill.setEnabled(isFloodfillEnabled()); + aSelectAll.setEnabled(isSelectAllEnabled()); } /** @@ -1944,6 +1948,13 @@ } } + /** Invoked when the user wants to select all squares from a map. */ + public void selectAll() { + if (isSelectAllEnabled()) { + mainControl.getCurrentMap().selectAll(); + } + } + /** * Determine if "clear" is enabled. * @return <code>true</code> if "clear" is enabled, <code>false</code> @@ -2035,6 +2046,15 @@ } /** + * Determine if "select all" is enabled. + * @return <code>true</code> if "select all" is enabled, + * <code>false</code> otherwise + */ + private boolean isSelectAllEnabled() { + return mainControl.getCurrentMap() != null; + } + + /** * Determine if the current map has a selection. * @return <code>true</code> a selection exists, <code>false</code> * otherwise Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/src/cfeditor/action.properties 2006-12-19 00:27:26 UTC (rev 1189) @@ -10,7 +10,7 @@ main.menubar=file edit map cursor pickmaps resources tools analyze view plugins window help file.menu=createNew open close - save saveAs revert createImg - options - exit -edit.menu=clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow floodfill +edit.menu=clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll map.menu=autoJoin - gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterUpperMap enterLowerMap tileShow - mapProperties cursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes pickmaps.menu=lockAllPickmaps - addNewPickmap closePickmap - openPickmapMap - savePickmap revertPickmap @@ -73,7 +73,9 @@ floodfill.icon=EmptySmallIcon +selectAll.icon=EmptySmallIcon + mapProperties.icon=general/Properties16 Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-19 00:27:26 UTC (rev 1189) @@ -229,6 +229,13 @@ mapModel.deleteMapArch(gameObject, pos, join); } + /** + * Selects all. + */ + public void selectAll() { + getMapGrid().selectAll(); + } + public GameObject getMapArch(final GameObject gameObject, final Point pos) { return mapModel.getMapArch(gameObject, pos); } Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-19 00:27:26 UTC (rev 1189) @@ -175,7 +175,11 @@ floodfill.text=Flood Fill +selectAll.text=Select All +selectAll.mnemonic=S +selectAll.accel=ctrl pressed A + ####### # Map Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-19 00:27:26 UTC (rev 1189) @@ -399,7 +399,11 @@ floodfill.text=Freien Bereich f\xFCllen +selectAll.text=Alles ausw\xE4hlen +selectAll.mnemonic=W +selectAll.accel=ctrl pressed A + ####### # Map Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-12-19 00:13:57 UTC (rev 1188) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-12-19 00:27:26 UTC (rev 1189) @@ -487,12 +487,7 @@ /** Mark all tiles as selected. */ public void selectAll() { - for (int x = 0; x < gridSize.getWidth(); x++) { - for (int y = 0; y < gridSize.getHeight(); y++) { - gridFlags[x][y] |= GRID_FLAG_SELECTION; - } - } - fireMapGridChangedEvent(); + setFlags(0, 0, gridSize.getWidth() - 1, gridSize.getHeight() - 1, GRID_FLAG_SELECTION); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |