You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-05-23 11:40:49
|
Revision: 7910 http://gridarta.svn.sourceforge.net/gridarta/?rev=7910&view=rev Author: akirschbaum Date: 2010-05-23 11:40:43 +0000 (Sun, 23 May 2010) Log Message: ----------- Rename function name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:39:35 UTC (rev 7909) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:40:43 UTC (rev 7910) @@ -640,7 +640,7 @@ aShiftSouthWest.setEnabled(doShift(false, 6)); aShiftWest.setEnabled(doShift(false, 3)); aShiftNorthWest.setEnabled(doShift(false, 7)); - aReplace.setEnabled(replace(false)); + aReplace.setEnabled(doReplace(false)); aFillAuto.setEnabled(doFillAuto(false)); aFillAbove.setEnabled(doFillAbove(false)); aFillBelow.setEnabled(doFillBelow(false)); @@ -758,7 +758,7 @@ */ @ActionMethod public void replace() { - replace(true); + doReplace(true); } /** @@ -889,7 +889,7 @@ * @param performAction whether the action should be performed * @return whether the action was or can be performed */ - private boolean replace(final boolean performAction) { + private boolean doReplace(final boolean performAction) { final MapView<G, A, R> mapView = currentMapView; if (mapView == null) { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 11:39:42
|
Revision: 7909 http://gridarta.svn.sourceforge.net/gridarta/?rev=7909&view=rev Author: akirschbaum Date: 2010-05-23 11:39:35 +0000 (Sun, 23 May 2010) Log Message: ----------- Fix possible NullPointerException. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:37:57 UTC (rev 7908) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:39:35 UTC (rev 7909) @@ -1086,13 +1086,15 @@ return false; } - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - if (!mapCursor.isActive()) { + final MapViewBasic<G, A, R> mapViewBasic = mapView.getMapViewBasic(); + final MapCursor mapCursor = mapViewBasic.getMapCursor(); + final Point mapCursorLocation = mapCursor.getLocation(); + if (mapCursorLocation == null) { return false; } if (performAction) { - FillUtils.floodfill(mapView.getMapControl().getMapModel(), mapCursor.getLocation(), objectChooser.getSelections(), insertionModeSet); + FillUtils.floodfill(mapView.getMapControl().getMapModel(), mapCursorLocation, objectChooser.getSelections(), insertionModeSet); } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 11:38:04
|
Revision: 7908 http://gridarta.svn.sourceforge.net/gridarta/?rev=7908&view=rev Author: akirschbaum Date: 2010-05-23 11:37:57 +0000 (Sun, 23 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 10:58:28 UTC (rev 7907) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:37:57 UTC (rev 7908) @@ -31,9 +31,11 @@ import javax.swing.JOptionPane; import net.sf.gridarta.commands.Collector; import net.sf.gridarta.gui.copybuffer.CopyBuffer; +import net.sf.gridarta.gui.map.cursor.MapCursor; import net.sf.gridarta.gui.map.cursor.MapCursorEvent; import net.sf.gridarta.gui.map.cursor.MapCursorListener; import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.misc.ShiftProcessor; @@ -67,7 +69,6 @@ import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.ExiterListener; -import net.sf.gridarta.utils.Pair; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.japi.swing.action.ActionBuilder; @@ -349,7 +350,7 @@ * <code>null</code>. */ @Nullable - private Collector collector = null; + private volatile Collector collector = null; /** * The map manager listener to detect created and closed map views. @@ -627,33 +628,33 @@ * Enable/disable menu entries based on the current state. */ private void refreshMenus() { - aClear.setEnabled(copyBuffer.clear(currentMapView, false)); - aCut.setEnabled(copyBuffer.cut(currentMapView, false)); - aCopy.setEnabled(copyBuffer.copy(currentMapView, false)); - aPaste.setEnabled(copyBuffer.paste(currentMapView, false)); - aShiftNorth.setEnabled(getShiftEnabled(0) != null); - aShiftNorthEast.setEnabled(getShiftEnabled(4) != null); - aShiftEast.setEnabled(getShiftEnabled(1) != null); - aShiftSouthEast.setEnabled(getShiftEnabled(5) != null); - aShiftSouth.setEnabled(getShiftEnabled(2) != null); - aShiftSouthWest.setEnabled(getShiftEnabled(6) != null); - aShiftWest.setEnabled(getShiftEnabled(3) != null); - aShiftNorthWest.setEnabled(getShiftEnabled(7) != null); + aClear.setEnabled(doClear(false)); + aCut.setEnabled(doCut(false)); + aCopy.setEnabled(doCopy(false)); + aPaste.setEnabled(doPaste(false)); + aShiftNorth.setEnabled(doShift(false, 0)); + aShiftNorthEast.setEnabled(doShift(false, 4)); + aShiftEast.setEnabled(doShift(false, 1)); + aShiftSouthEast.setEnabled(doShift(false, 5)); + aShiftSouth.setEnabled(doShift(false, 2)); + aShiftSouthWest.setEnabled(doShift(false, 6)); + aShiftWest.setEnabled(doShift(false, 3)); + aShiftNorthWest.setEnabled(doShift(false, 7)); aReplace.setEnabled(replace(false)); - aFillAuto.setEnabled(getFillAutoEnabled() != null); - aFillAbove.setEnabled(getFillAboveEnabled() != null); - aFillBelow.setEnabled(getFillBelowEnabled() != null); - aRandFillAuto.setEnabled(getRandFillAutoEnabled() != null); - aRandFillAbove.setEnabled(getRandFillAboveEnabled() != null); - aRandFillBelow.setEnabled(getRandFillBelowEnabled() != null); - aFloodfill.setEnabled(getFloodfillEnabled() != null); - aSelectAll.setEnabled(getSelectAllEnabled() != null); - aExpandEmptySelection.setEnabled(getExpandEmptySelectionEnabled() != null); - aGrowSelection.setEnabled(getGrowSelectionEnabled() != null); - aShrinkSelection.setEnabled(getShrinkSelectionEnabled() != null); - aCollectArches.setEnabled(isCollectArchesEnabled()); - aReloadFaces.setEnabled(!archetypeSet.isLoadedFromArchive()); - aValidateMap.setEnabled(getValidateMapEnabled() != null); + aFillAuto.setEnabled(doFillAuto(false)); + aFillAbove.setEnabled(doFillAbove(false)); + aFillBelow.setEnabled(doFillBelow(false)); + aRandFillAuto.setEnabled(doRandFillAuto(false)); + aRandFillAbove.setEnabled(doRandFillAbove(false)); + aRandFillBelow.setEnabled(doRandFillBelow(false)); + aFloodfill.setEnabled(doFloodFill(false)); + aSelectAll.setEnabled(doSelectAll(false)); + aExpandEmptySelection.setEnabled(doExpandEmptySelection(false)); + aGrowSelection.setEnabled(doGrowSelection(false)); + aShrinkSelection.setEnabled(doShrinkSelection(false)); + aCollectArches.setEnabled(doCollectArches(false)); + aReloadFaces.setEnabled(doReloadFaces(false)); + aValidateMap.setEnabled(doValidateMap(false)); } /** @@ -661,7 +662,7 @@ */ @ActionMethod public void clear() { - copyBuffer.clear(currentMapView, true); + doClear(true); } /** @@ -669,7 +670,7 @@ */ @ActionMethod public void cut() { - copyBuffer.cut(currentMapView, true); + doCut(true); } /** @@ -677,7 +678,7 @@ */ @ActionMethod public void copy() { - copyBuffer.copy(currentMapView, true); + doCopy(true); } /** @@ -685,7 +686,7 @@ */ @ActionMethod public void paste() { - copyBuffer.paste(currentMapView, true); + doPaste(true); } /** @@ -693,7 +694,7 @@ */ @ActionMethod public void shiftNorth() { - shift(0); + doShift(true, 0); } /** @@ -701,7 +702,7 @@ */ @ActionMethod public void shiftNorthEast() { - shift(4); + doShift(true, 4); } /** @@ -709,7 +710,7 @@ */ @ActionMethod public void shiftEast() { - shift(1); + doShift(true, 1); } /** @@ -717,7 +718,7 @@ */ @ActionMethod public void shiftSouthEast() { - shift(5); + doShift(true, 5); } /** @@ -725,7 +726,7 @@ */ @ActionMethod public void shiftSouth() { - shift(2); + doShift(true, 2); } /** @@ -733,7 +734,7 @@ */ @ActionMethod public void shiftSouthWest() { - shift(6); + doShift(true, 6); } /** @@ -741,7 +742,7 @@ */ @ActionMethod public void shiftWest() { - shift(3); + doShift(true, 3); } /** @@ -749,21 +750,10 @@ */ @ActionMethod public void shiftNorthWest() { - shift(7); + doShift(true, 7); } /** - * Shift the selection into the given direction. - * @param dir The direction to shift. - */ - private void shift(final int dir) { - final ShiftProcessor<G, A, R> shiftProcessor = getShiftEnabled(dir); - if (shiftProcessor != null) { - shiftProcessor.shift(dir); - } - } - - /** * "Replace" was selected from the Edit menu. */ @ActionMethod @@ -776,10 +766,7 @@ */ @ActionMethod public void fillAuto() { - final MapView<G, A, R> mapView = getFillAutoEnabled(); - if (mapView != null) { - fill(mapView, insertionModeSet.getAutoInsertionMode()); - } + doFillAuto(true); } /** @@ -787,10 +774,7 @@ */ @ActionMethod public void fillAbove() { - final MapView<G, A, R> mapView = getFillAboveEnabled(); - if (mapView != null) { - fill(mapView, insertionModeSet.getTopmostInsertionMode()); - } + doFillAbove(true); } /** @@ -798,30 +782,15 @@ */ @ActionMethod public void fillBelow() { - final MapView<G, A, R> mapView = getFillBelowEnabled(); - if (mapView != null) { - fill(mapView, insertionModeSet.getBottommostInsertionMode()); - } + doFillBelow(true); } /** - * "Fill" was selected from the Edit menu. - * @param mapView the map view to fill - * @param insertionMode the insertion mode to use - */ - private void fill(@NotNull final MapView<G, A, R> mapView, @NotNull final InsertionMode<G, A, R> insertionMode) { - FillUtils.fill(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getSelection(), insertionMode, objectChooser.getSelections(), -1); - } - - /** * "Random fill" was selected from the Edit menu. */ @ActionMethod public void randFillAuto() { - final MapView<G, A, R> mapView = getRandFillAutoEnabled(); - if (mapView != null) { - fillRandom(mapView, insertionModeSet.getAutoInsertionMode()); - } + doRandFillAuto(true); } /** @@ -829,10 +798,7 @@ */ @ActionMethod public void randFillAbove() { - final MapView<G, A, R> mapView = getRandFillAboveEnabled(); - if (mapView != null) { - fillRandom(mapView, insertionModeSet.getTopmostInsertionMode()); - } + doRandFillAbove(true); } /** @@ -840,60 +806,15 @@ */ @ActionMethod public void randFillBelow() { - final MapView<G, A, R> mapView = getRandFillBelowEnabled(); - if (mapView != null) { - fillRandom(mapView, insertionModeSet.getBottommostInsertionMode()); - } + doRandFillBelow(true); } /** - * "RandomFill" was selected from the Edit menu. - * @param mapView the map view to fill - * @param insertionMode the insertion mode to use - */ - private void fillRandom(@NotNull final MapView<G, A, R> mapView, @NotNull final InsertionMode<G, A, R> insertionMode) { - final int rand = getFillDensity("Random fill"); - if (rand >= 0) { - FillUtils.fill(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getSelection(), insertionMode, objectChooser.getSelections(), rand); - } - } - - /** - * Asks the user for the fill density. - * @param title the title for the dialog box - * @return the fill density or <code>-1</code> if the dialog was cancelled - */ - private int getFillDensity(@NotNull final String title) { - String input = "100"; - for (; ;) { - input = (String) JOptionPane.showInputDialog(parent, "Enter a fill density between 1-100", title, JOptionPane.QUESTION_MESSAGE, null, null, input); - if (input == null) { - return -1; - } - - int rand; - try { - rand = Integer.parseInt(input); - } catch (final NumberFormatException ignored) { - rand = -1; - } - if (rand < 1 || rand > 100) { - JOptionPane.showMessageDialog(parent, "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); - } else { - return rand; - } - } - } - - /** * "Floodfill" was selected from the Edit menu. */ @ActionMethod public void floodfill() { - final MapView<G, A, R> mapView = getFloodfillEnabled(); - if (mapView != null) { - FillUtils.floodfill(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getMapCursor().getLocation(), objectChooser.getSelections(), insertionModeSet); - } + doFloodFill(true); } /** @@ -901,10 +822,7 @@ */ @ActionMethod public void selectAll() { - final MapGrid mapGrid = getSelectAllEnabled(); - if (mapGrid != null) { - mapGrid.selectAll(); - } + doSelectAll(true); } /** @@ -913,51 +831,7 @@ */ @ActionMethod public void expandEmptySelection() { - final Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> selectedSquares = getExpandEmptySelectionEnabled(); - if (selectedSquares != null) { - final MapView<G, A, R> mapView = selectedSquares.getFirst(); - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); - final Map<MapSquare<G, A, R>, Void> newSelection = new IdentityHashMap<MapSquare<G, A, R>, Void>(); - Map<MapSquare<G, A, R>, Void> todo = new IdentityHashMap<MapSquare<G, A, R>, Void>(); - for (final MapSquare<G, A, R> mapSquare : selectedSquares.getSecond()) { - todo.put(mapSquare, null); - newSelection.put(mapSquare, null); - } - final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); - final Point point = new Point(); - while (!todo.isEmpty()) { - final Map<MapSquare<G, A, R>, Void> tmp = new IdentityHashMap<MapSquare<G, A, R>, Void>(); - for (final MapSquare<G, A, R> mapSquare : todo.keySet()) { - for (int dy = -1; dy <= 1; dy++) { - point.y = mapSquare.getMapY() + dy; - for (int dx = -1; dx <= 1; dx++) { - if (dx != 0 || dy != 0) { - point.x = mapSquare.getMapX() + dx; - if (mapModel.isPointValid(point)) { - final MapSquare<G, A, R> newMapSquare = mapModel.getMapSquare(point); - if (newMapSquare.isEmpty() && !newSelection.containsKey(newMapSquare)) { - tmp.put(newMapSquare, null); - newSelection.put(newMapSquare, null); - } - } - } - } - } - } - todo = tmp; - } - mapGrid.beginTransaction(); - try { - mapGrid.unSelect(); - for (final MapSquare<G, A, R> mapSquare : newSelection.keySet()) { - point.x = mapSquare.getMapX(); - point.y = mapSquare.getMapY(); - mapGrid.select(point, point, SelectionMode.ADD); - } - } finally { - mapGrid.endTransaction(); - } - } + doExpandEmptySelection(true); } /** @@ -965,31 +839,7 @@ */ @ActionMethod public void growSelection() { - final Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> selectedSquares = getGrowSelectionEnabled(); - if (selectedSquares == null) { - return; - } - - final MapView<G, A, R> mapView = selectedSquares.getFirst(); - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); - final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); - final Point point = new Point(); - mapGrid.beginTransaction(); - try { - for (final MapSquare<G, A, R> mapSquare : selectedSquares.getSecond()) { - for (int dy = -1; dy <= 1; dy++) { - point.y = mapSquare.getMapY() + dy; - for (int dx = -1; dx <= 1; dx++) { - point.x = mapSquare.getMapX() + dx; - if (mapModel.isPointValid(point)) { - mapGrid.select(point, point, SelectionMode.ADD); - } - } - } - } - } finally { - mapGrid.endTransaction(); - } + doGrowSelection(true); } /** @@ -997,41 +847,7 @@ */ @ActionMethod public void shrinkSelection() { - final Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> selectedSquares = getShrinkSelectionEnabled(); - if (selectedSquares == null) { - return; - } - - final MapView<G, A, R> mapView = selectedSquares.getFirst(); - final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); - final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); - final Point point = new Point(); - final Map<MapSquare<G, A, R>, Void> mapSquaresToShrink = new IdentityHashMap<MapSquare<G, A, R>, Void>(); - mapGrid.beginTransaction(); - try { - for (final MapSquare<G, A, R> mapSquare : selectedSquares.getSecond()) { -LOOP: - for (int dy = -1; dy <= 1; dy++) { - point.y = mapSquare.getMapY() + dy; - for (int dx = -1; dx <= 1; dx++) { - if (dx != 0 || dy != 0) { - point.x = mapSquare.getMapX() + dx; - if (mapModel.isPointValid(point) && (mapGrid.getFlags(point) & MapGrid.GRID_FLAG_SELECTION) == 0) { - mapSquaresToShrink.put(mapSquare, null); - break LOOP; - } - } - } - } - } - for (final MapSquare<G, A, R> mapSquare : mapSquaresToShrink.keySet()) { - point.x = mapSquare.getMapX(); - point.y = mapSquare.getMapY(); - mapGrid.select(point, point, SelectionMode.SUB); - } - } finally { - mapGrid.endTransaction(); - } + doShrinkSelection(true); } /** @@ -1039,280 +855,563 @@ */ @ActionMethod public void collectArches() { - final Progress progress = new AsynchonousProgress(new ProgressDisplay(parent, ACTION_BUILDER.getString("archCollectTitle"), 0, ACTION_BUILDER.getString("archCollectArches"))); - collectArches(progress); + doCollectArches(true); } - private synchronized void collectArches(@NotNull final Progress progress) { - if (collector != null) { - progress.finished(); - return; - } + /** + * Invoked when the user wants to reload the images. + */ + @ActionMethod + public void reloadFaces() { + doReloadFaces(true); + } - final Progress collectArches = new Progress() { + /** + * Invoked when "validate map" was selected. + */ + @ActionMethod + public void validateMap() { + doValidateMap(true); + } - /** {@inheritDoc} */ - @Override - public void finished() { - progress.finished(); - collector = null; - aCollectArches.setEnabled(isCollectArchesEnabled()); - } + /** + * Determine if the current map has a selection. + * @return the map view if a selection exists, or <code>null</code> + * otherwise + */ + @Nullable + private MapView<G, A, R> getSelection() { + return currentMapView != null && currentMapView.getMapViewBasic().getMapGrid().getSelectedRec() != null ? currentMapView : null; + } - /** {@inheritDoc} */ - @Override - public Component getParentComponent() { - return progress.getParentComponent(); - } + /** + * Executes the "replace" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean replace(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } - /** {@inheritDoc} */ - @Override - public void setLabel(final String msg, final int max) { - progress.setLabel(msg, max); - } + if (performAction) { + replaceDialogManager.showDialog(mapView); + } - /** {@inheritDoc} */ - @Override - public void setValue(final int value) { - progress.setValue(value); - } + return true; + } - }; + /** + * Executes the "clear" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doClear(final boolean performAction) { + return copyBuffer.clear(currentMapView, performAction); + } - collector = new Collector(collectArches, resources, globalSettings.getCollectedDirectory()); - collector.start(); - aCollectArches.setEnabled(isCollectArchesEnabled()); + /** + * Executes the "cut" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doCut(final boolean performAction) { + return copyBuffer.cut(currentMapView, performAction); } /** - * Invoked when the user wants to reload the images. + * Executes the "copy" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void reloadFaces() { - faceObjectProviders.reloadAll(); + private boolean doCopy(final boolean performAction) { + return copyBuffer.copy(currentMapView, performAction); } /** - * Invoked when "validate map" was selected. + * Executes the "paste" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void validateMap() { - final MapModel<G, A, R> mapModel = getValidateMapEnabled(); - if (mapModel != null) { - validators.validateAll(mapModel); - } + private boolean doPaste(final boolean performAction) { + return copyBuffer.paste(currentMapView, performAction); } /** - * Determine if "shift" is enabled. - * @param dir The shift direction. - * @return A shift processor if "shift" is enabled, or <code>null</code> - * otherwise. + * Executes the "shift" action. + * @param performAction whether the action should be performed + * @param direction the direction to shift + * @return whether the action was or can be performed */ - @Nullable - private ShiftProcessor<G, A, R> getShiftEnabled(final int dir) { + private boolean doShift(final boolean performAction, final int direction) { final MapControl<G, A, R> mapControl = currentMapControl; if (mapControl == null) { - return null; + return false; } final MapView<G, A, R> mapView = currentMapView; if (mapView == null) { - return null; + return false; } final ShiftProcessor<G, A, R> shiftProcessor = new ShiftProcessor<G, A, R>(mapViewSettings, mapView, mapControl.getMapModel(), gameObjectFactory, insertionModeSet); - return shiftProcessor.canShift(dir) ? shiftProcessor : null; + if (!shiftProcessor.canShift(direction)) { + return false; + } + + if (performAction) { + shiftProcessor.shift(direction); + } + + return true; } /** - * Determine if "fill" is enabled. - * @return the map view to fill if "fill" is enabled, or <code>null</code> - * otherwise + * Executes the "fill auto" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getFillAutoEnabled() { - return getSelection(); + private boolean doFillAuto(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fill(mapView, insertionModeSet.getAutoInsertionMode()); + } + + return true; } /** - * Determine if "fill above" is enabled. - * @return the map view to fill if "fill above" is enabled, or - * <code>null</code> otherwise + * Executes the "fill above" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getFillAboveEnabled() { - return getSelection(); + private boolean doFillAbove(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fill(mapView, insertionModeSet.getTopmostInsertionMode()); + } + + return true; } /** - * Determine if "fill below" is enabled. - * @return the map view to fill if "fill below" is enabled, or - * <code>null</code> otherwise + * Executes the "fill below" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getFillBelowEnabled() { - return getSelection(); + private boolean doFillBelow(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fill(mapView, insertionModeSet.getBottommostInsertionMode()); + } + + return true; } /** - * Determine if "random fill" is enabled. - * @return the map view to fill if "random fill" is enabled, or - * <code>null</code> otherwise + * Executes the "rand fill auto" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getRandFillAutoEnabled() { - return getSelection(); + private boolean doRandFillAuto(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fillRandom(mapView, insertionModeSet.getAutoInsertionMode()); + } + + return true; } /** - * Determine if "random fill above" is enabled. - * @return the map view to fill if "random fill above" is enabled, or - * <code>null</code> otherwise + * Executes the "rand fill above" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getRandFillAboveEnabled() { - return getSelection(); + private boolean doRandFillAbove(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fillRandom(mapView, insertionModeSet.getTopmostInsertionMode()); + } + + return true; } /** - * Determine if "random fill below" is enabled. - * @return the map view to fill if "random fill below" is enabled, or - * <code>null</code> otherwise + * Executes the "rand fill below" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getRandFillBelowEnabled() { - return getSelection(); + private boolean doRandFillBelow(final boolean performAction) { + final MapView<G, A, R> mapView = getSelection(); + if (mapView == null) { + return false; + } + + if (performAction) { + fillRandom(mapView, insertionModeSet.getBottommostInsertionMode()); + } + + return true; } /** - * Determine if "floodfill" is enabled. - * @return the map view to fill if "floodfill" is enabled, or - * <code>null</code> otherwise + * Executes the "flood fill" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getFloodfillEnabled() { - return getCursor(); + private boolean doFloodFill(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + if (!mapCursor.isActive()) { + return false; + } + + if (performAction) { + FillUtils.floodfill(mapView.getMapControl().getMapModel(), mapCursor.getLocation(), objectChooser.getSelections(), insertionModeSet); + } + + return true; } /** - * Determine if "select all" is enabled. - * @return the map grid to select if "select all" is enabled, or - * <code>null</code> otherwise + * Executes the "select all" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapGrid getSelectAllEnabled() { - return currentMapView != null ? currentMapView.getMapViewBasic().getMapGrid() : null; + private boolean doSelectAll(final boolean performAction) { + if (currentMapView == null) { + return false; + } + + if (performAction) { + currentMapView.getMapViewBasic().getMapGrid().selectAll(); + } + + return true; } /** - * Determine if "expand empty selection" is enabled. - * @return the map view/selected squares to expand if "expand empty - * selection" is enabled, or <code>null</code> otherwise + * Executes the "expand empty selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> getExpandEmptySelectionEnabled() { + private boolean doExpandEmptySelection(final boolean performAction) { final MapView<G, A, R> mapView = getSelection(); if (mapView == null) { - return null; + return false; } + boolean foundEmptySelectedSquare = false; final List<MapSquare<G, A, R>> selectedSquares = mapView.getMapViewBasic().getSelectedSquares(); for (final MapSquare<G, A, R> selectedSquare : selectedSquares) { if (selectedSquare.isEmpty()) { - return new Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>>(mapView, selectedSquares); + foundEmptySelectedSquare = true; + break; } } + if (!foundEmptySelectedSquare) { + return false; + } - return null; + if (performAction) { + final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); + final Map<MapSquare<G, A, R>, Void> newSelection = new IdentityHashMap<MapSquare<G, A, R>, Void>(); + Map<MapSquare<G, A, R>, Void> todo = new IdentityHashMap<MapSquare<G, A, R>, Void>(); + for (final MapSquare<G, A, R> mapSquare : selectedSquares) { + todo.put(mapSquare, null); + newSelection.put(mapSquare, null); + } + final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); + final Point point = new Point(); + while (!todo.isEmpty()) { + final Map<MapSquare<G, A, R>, Void> tmp = new IdentityHashMap<MapSquare<G, A, R>, Void>(); + for (final MapSquare<G, A, R> mapSquare : todo.keySet()) { + for (int dy = -1; dy <= 1; dy++) { + point.y = mapSquare.getMapY() + dy; + for (int dx = -1; dx <= 1; dx++) { + if (dx != 0 || dy != 0) { + point.x = mapSquare.getMapX() + dx; + if (mapModel.isPointValid(point)) { + final MapSquare<G, A, R> newMapSquare = mapModel.getMapSquare(point); + if (newMapSquare.isEmpty() && !newSelection.containsKey(newMapSquare)) { + tmp.put(newMapSquare, null); + newSelection.put(newMapSquare, null); + } + } + } + } + } + } + todo = tmp; + } + mapGrid.beginTransaction(); + try { + mapGrid.unSelect(); + for (final MapSquare<G, A, R> mapSquare : newSelection.keySet()) { + point.x = mapSquare.getMapX(); + point.y = mapSquare.getMapY(); + mapGrid.select(point, point, SelectionMode.ADD); + } + } finally { + mapGrid.endTransaction(); + } + } + + return true; } /** - * Determines if "grow selection" is enabled. - * @return the map view/selected squares to grow if "expand selection" is - * enabled, or <code>null</code> otherwise + * Executes the "grow selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> getGrowSelectionEnabled() { + private boolean doGrowSelection(final boolean performAction) { final MapView<G, A, R> mapView = getSelection(); if (mapView == null) { - return null; + return false; } - final List<MapSquare<G, A, R>> selectedSquares = mapView.getMapViewBasic().getSelectedSquares(); - return selectedSquares.isEmpty() ? null : new Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>>(mapView, selectedSquares); + final MapViewBasic<G,A,R> mapViewBasic = mapView.getMapViewBasic(); + final List<MapSquare<G, A, R>> selectedSquares = mapViewBasic.getSelectedSquares(); + if (selectedSquares.isEmpty()) { + return false; + } + + if (performAction) { + final MapGrid mapGrid = mapViewBasic.getMapGrid(); + final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); + final Point point = new Point(); + mapGrid.beginTransaction(); + try { + for (final MapSquare<G, A, R> mapSquare : selectedSquares) { + for (int dy = -1; dy <= 1; dy++) { + point.y = mapSquare.getMapY() + dy; + for (int dx = -1; dx <= 1; dx++) { + point.x = mapSquare.getMapX() + dx; + if (mapModel.isPointValid(point)) { + mapGrid.select(point, point, SelectionMode.ADD); + } + } + } + } + } finally { + mapGrid.endTransaction(); + } + } + + return true; } /** - * Determines if "shrink selection" is enabled. - * @return the map view/selected squares to shrink if "shrink selection" is - * enabled, or <code>null</code> otherwise + * Executes the "shrink selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>> getShrinkSelectionEnabled() { + private boolean doShrinkSelection(final boolean performAction) { final MapView<G, A, R> mapView = getSelection(); if (mapView == null) { - return null; + return false; } - final List<MapSquare<G, A, R>> selectedSquares = mapView.getMapViewBasic().getSelectedSquares(); - return selectedSquares.isEmpty() ? null : new Pair<MapView<G, A, R>, List<MapSquare<G, A, R>>>(mapView, selectedSquares); + final MapViewBasic<G, A, R> mapViewBasic = mapView.getMapViewBasic(); + final List<MapSquare<G, A, R>> selectedSquares = mapViewBasic.getSelectedSquares(); + if (selectedSquares.isEmpty()) { + return false; + } + + if (performAction) { + final MapGrid mapGrid = mapViewBasic.getMapGrid(); + final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); + final Point point = new Point(); + final Map<MapSquare<G, A, R>, Void> mapSquaresToShrink = new IdentityHashMap<MapSquare<G, A, R>, Void>(); + mapGrid.beginTransaction(); + try { + for (final MapSquare<G, A, R> mapSquare : selectedSquares) { +LOOP: + for (int dy = -1; dy <= 1; dy++) { + point.y = mapSquare.getMapY() + dy; + for (int dx = -1; dx <= 1; dx++) { + if (dx != 0 || dy != 0) { + point.x = mapSquare.getMapX() + dx; + if (mapModel.isPointValid(point) && (mapGrid.getFlags(point) & MapGrid.GRID_FLAG_SELECTION) == 0) { + mapSquaresToShrink.put(mapSquare, null); + break LOOP; + } + } + } + } + } + for (final MapSquare<G, A, R> mapSquare : mapSquaresToShrink.keySet()) { + point.x = mapSquare.getMapX(); + point.y = mapSquare.getMapY(); + mapGrid.select(point, point, SelectionMode.SUB); + } + } finally { + mapGrid.endTransaction(); + } + } + + return true; } /** - * Returns whether "collect archetypes" is enabled. - * @return whether "collect archetypes" is enabled + * Executes the "collect arches" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - private boolean isCollectArchesEnabled() { - return collector == null && resources.canWriteCollected(); - } + private boolean doCollectArches(final boolean performAction) { + synchronized (this) { + if (collector != null || !resources.canWriteCollected()) { + return false; + } - /** - * Determine if "validate map" is enabled. - * @return The map model to check if "validate map" is enabled, or - * <code>null</code> otherwise. - */ - @Nullable - private MapModel<G, A, R> getValidateMapEnabled() { - final MapControl<G, A, R> mapControl = currentMapControl; - return mapControl == null ? null : mapControl.getMapModel(); + if (performAction) { + final Progress progress = new AsynchonousProgress(new ProgressDisplay(parent, ACTION_BUILDER.getString("archCollectTitle"), 0, ACTION_BUILDER.getString("archCollectArches"))); + final Progress collectArches = new Progress() { + + /** {@inheritDoc} */ + @Override + public void finished() { + progress.finished(); + collector = null; + aCollectArches.setEnabled(doCollectArches(false)); + } + + /** {@inheritDoc} */ + @Override + public Component getParentComponent() { + return progress.getParentComponent(); + } + + /** {@inheritDoc} */ + @Override + public void setLabel(final String msg, final int max) { + progress.setLabel(msg, max); + } + + /** {@inheritDoc} */ + @Override + public void setValue(final int value) { + progress.setValue(value); + } + + }; + + collector = new Collector(collectArches, resources, globalSettings.getCollectedDirectory()); + collector.start(); + aCollectArches.setEnabled(doCollectArches(false)); + } + } + + return true; } /** - * Determine if the current map has a selection. - * @return the map view if a selection exists, or <code>null</code> - * otherwise + * Executes the "reload faces" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getSelection() { - return currentMapView != null && currentMapView.getMapViewBasic().getMapGrid().getSelectedRec() != null ? currentMapView : null; - } + private boolean doReloadFaces(final boolean performAction) { + if (archetypeSet.isLoadedFromArchive()) { + return false; + } - /** - * Determine if the current map has an active cursor. - * @return the map view if a cursor exists, or <code>null</code> otherwise - */ - @Nullable - private MapView<G, A, R> getCursor() { - return currentMapView != null && currentMapView.getMapViewBasic().getMapCursor().isActive() ? currentMapView : null; + if (performAction) { + faceObjectProviders.reloadAll(); + } + + return true; } /** - * Executes the "replace" action. + * Executes the "validate map" action. * @param performAction whether the action should be performed * @return whether the action was or can be performed */ - private boolean replace(final boolean performAction) { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { + private boolean doValidateMap(final boolean performAction) { + final MapControl<G, A, R> mapControl = currentMapControl; + if (mapControl == null) { return false; } if (performAction) { - replaceDialogManager.showDialog(mapView); + validators.validateAll(mapControl.getMapModel()); } return true; } + /** + * "Fill" was selected from the Edit menu. + * @param mapView the map view to fill + * @param insertionMode the insertion mode to use + */ + private void fill(@NotNull final MapView<G, A, R> mapView, @NotNull final InsertionMode<G, A, R> insertionMode) { + FillUtils.fill(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getSelection(), insertionMode, objectChooser.getSelections(), -1); + } + + /** + * "RandomFill" was selected from the Edit menu. + * @param mapView the map view to fill + * @param insertionMode the insertion mode to use + */ + private void fillRandom(@NotNull final MapView<G, A, R> mapView, @NotNull final InsertionMode<G, A, R> insertionMode) { + final int rand = getFillDensity("Random fill"); + if (rand >= 0) { + FillUtils.fill(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getSelection(), insertionMode, objectChooser.getSelections(), rand); + } + } + + /** + * Asks the user for the fill density. + * @param title the title for the dialog box + * @return the fill density or <code>-1</code> if the dialog was cancelled + */ + private int getFillDensity(@NotNull final String title) { + String input = "100"; + for (; ;) { + input = (String) JOptionPane.showInputDialog(parent, "Enter a fill density between 1-100", title, JOptionPane.QUESTION_MESSAGE, null, null, input); + if (input == null) { + return -1; + } + + int rand; + try { + rand = Integer.parseInt(input); + } catch (final NumberFormatException ignored) { + rand = -1; + } + if (rand < 1 || rand > 100) { + JOptionPane.showMessageDialog(parent, "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); + } else { + return rand; + } + } + } + } // class MainActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:58:35
|
Revision: 7907 http://gridarta.svn.sourceforge.net/gridarta/?rev=7907&view=rev Author: akirschbaum Date: 2010-05-23 10:58:28 +0000 (Sun, 23 May 2010) Log Message: ----------- Move code to create actions from GUIMainControl to HelpActions. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java 2010-05-23 10:55:24 UTC (rev 7906) +++ trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java 2010-05-23 10:58:28 UTC (rev 7907) @@ -21,6 +21,9 @@ import java.awt.Frame; import net.sf.gridarta.gui.help.Help; +import net.sf.gridarta.utils.ActionUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.jetbrains.annotations.NotNull; @@ -30,7 +33,6 @@ * @author Andreas Kirschbaum */ public class HelpActions { - /** * The main view {@link Frame}. */ @@ -43,6 +45,8 @@ */ public HelpActions(@NotNull final Frame mainViewFrame) { this.mainViewFrame = mainViewFrame; + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + ActionUtils.newActions(actionBuilder, "Help", this, "showHelp", "tipOfTheDay"); } /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-23 10:55:24 UTC (rev 7906) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-23 10:58:28 UTC (rev 7907) @@ -472,7 +472,6 @@ new MapFileActions<G, A, R>(imageCreator2, mapManager, mapViewsManager, mapViewManager, fileControl, mainViewFrame); new MainActions<G, A, R>(replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, gameObjectFactory, insertionModeSet, exiter); final HelpActions helpActions = new HelpActions(mainViewFrame); - ActionUtils.newActions(ACTION_BUILDER, "Help", helpActions, "showHelp", "tipOfTheDay"); ActionUtils.newActions(ACTION_BUILDER, "Map", newMapDialogFactory, "newMap"); ActionUtils.newActions(ACTION_BUILDER, "Tool", this, "cleanCompletelyBlockedSquares", "collectSpells", "controlClient", "controlServer", "gc", "options", "shortcuts", "zoom"); new MapCursorActions<G, A, R>(gameObjectAttributesDialogFactory, mapViewManager, selectedSquareControl, selectedSquareModel); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:55:32
|
Revision: 7906 http://gridarta.svn.sourceforge.net/gridarta/?rev=7906&view=rev Author: akirschbaum Date: 2010-05-23 10:55:24 +0000 (Sun, 23 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2010-05-23 10:50:28 UTC (rev 7905) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2010-05-23 10:55:24 UTC (rev 7906) @@ -155,7 +155,7 @@ * Updates the actions' states. */ private void refresh() { - aDeletePickmapFolder.setEnabled(getDeletePickmapFolderEnabled() != null); + aDeletePickmapFolder.setEnabled(doDeletePickmapFolder(false)); if (folderMenu == null) { return; @@ -184,31 +184,33 @@ */ @ActionMethod public void deletePickmapFolder() { - final MapFolder<G, A, R> mapFolder = getDeletePickmapFolderEnabled(); - if (mapFolder == null) { - return; + doDeletePickmapFolder(true); + } + + /** + * Executes the "close map" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doDeletePickmapFolder(final boolean performAction) { + final MapFolder<G, A, R> mapFolder = activeMapFolder; + if (mapFolder == null || mapFolder.getParent() == null) { + return false; } if (mapFolder.getPickmaps() > 0 && !ACTION_BUILDER.showQuestionDialog(null/*XXX:parent*/, confirmDeleteFolderKey, mapFolder.getName(), mapFolder.getPickmaps())) { - return; + return false; } - try { - mapFolderTree.removeMapFolder(mapFolder, true); - } catch (final MapFolderNotEmptyException ex) { - ACTION_BUILDER.showMessageDialog(null/*XXX:parent*/, deleteFolderNotEmptyKey, mapFolder.getName()); + if (performAction) { + try { + mapFolderTree.removeMapFolder(mapFolder, true); + } catch (final MapFolderNotEmptyException ex) { + ACTION_BUILDER.showMessageDialog(null/*XXX:parent*/, deleteFolderNotEmptyKey, mapFolder.getName()); + } } - } - /** - * Returns whether "delete pickmap folder" should be enabled. - * @return the folder to delete, or <code>null</code> if the action should - * be disabled - */ - @Nullable - private MapFolder<G, A, R> getDeletePickmapFolderEnabled() { - final MapFolder<G, A, R> mapFolder = activeMapFolder; - return mapFolder != null && mapFolder.getParent() != null ? mapFolder : null; + return true; } } // class MapFolderTreeActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:50:35
|
Revision: 7905 http://gridarta.svn.sourceforge.net/gridarta/?rev=7905&view=rev Author: akirschbaum Date: 2010-05-23 10:50:28 +0000 (Sun, 23 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-23 10:11:24 UTC (rev 7904) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-23 10:50:28 UTC (rev 7905) @@ -438,7 +438,7 @@ */ @ActionMethod public boolean isGridVisible() { - return isGridVisibleEnabled() && mapViewSettings.isGridVisible(); + return doGridVisible(false, false) && mapViewSettings.isGridVisible(); } /** @@ -450,9 +450,7 @@ */ @ActionMethod public void setGridVisible(final boolean gridVisible) { - if (isGridVisibleEnabled()) { - mapViewSettings.setGridVisible(gridVisible); - } + doGridVisible(true, gridVisible); } /** @@ -462,7 +460,7 @@ */ @ActionMethod public boolean isSmoothing() { - return isSmoothingEnabled() && mapViewSettings.isSmoothing(); + return doSmoothing(false, false) && mapViewSettings.isSmoothing(); } /** @@ -473,9 +471,7 @@ */ @ActionMethod public void setSmoothing(final boolean smoothing) { - if (isSmoothingEnabled()) { - mapViewSettings.setSmoothing(smoothing); - } + doSmoothing(true, smoothing); } /** @@ -485,7 +481,7 @@ */ @ActionMethod public boolean isDoubleFaces() { - return isDoubleFacesEnabled() && mapViewSettings.isDoubleFaces(); + return doDoubleFaces(false, false) && mapViewSettings.isDoubleFaces(); } /** @@ -495,19 +491,17 @@ */ @ActionMethod public void setDoubleFaces(final boolean doubleFaces) { - if (isDoubleFacesEnabled()) { - mapViewSettings.setDoubleFaces(doubleFaces); - } + doDoubleFaces(true, doubleFaces); } /** * Action method for "tile show". - * @return <code>true</code> if adjacent tiles are shown, or - * <code>false</code> if adjacent tiles are not shown + * @return <code>true</code> if adjacent tiles are shwon, or + * <code>false</code> if not */ @ActionMethod public boolean isTileShow() { - return false; + return doTileShow(false, false) && false; // XXX: not yet implemented } /** @@ -516,7 +510,7 @@ */ @ActionMethod public void setTileShow(final boolean tileShow) { - // not yet implemented + doTileShow(true, tileShow); } /** @@ -524,10 +518,7 @@ */ @ActionMethod public void mapCreateView() { - final MapView<G, A, R> mapView = getCreateViewEnabled(); - if (mapView != null) { - mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getViewport().getViewPosition()); - } + doMapCreateView(true); } /** @@ -535,10 +526,7 @@ */ @ActionMethod public void mapProperties() { - final MapView<G, A, R> mapView = getMapPropertiesEnabled(); - if (mapView != null) { - mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapView.getMapControl().getMapModel(), mapFileFilter); - } + doMapProperties(true); } /** @@ -546,10 +534,7 @@ */ @ActionMethod public void shrinkMapSize() { - final MapView<G, A, R> mapView = getShrinkMapSizeEnabled(); - if (mapView != null) { - shrinkMapSizeDialogManager.showDialog(mapView); - } + doShrinkMapSize(true); } /** @@ -559,18 +544,16 @@ */ @ActionMethod public boolean isAutoJoin() { - return mapViewSettings.isAutojoin(); + return doAutoJoin(false, false) && mapViewSettings.isAutojoin(); } /** - * Action method for "autojoin". - * @param autojoin if set, enable autojoining + * Action method for "autoJoin". + * @param autoJoin if set, enable autojoining */ @ActionMethod - public void setAutoJoin(final boolean autojoin) { - if (isAutojoinEnabled()) { - mapViewSettings.setAutojoin(autojoin); - } + public void setAutoJoin(final boolean autoJoin) { + doAutoJoin(true, autoJoin); } /** @@ -578,25 +561,7 @@ */ @ActionMethod public void enterExit() { - final GameObject<G, A, R> exit = getEnterExitEnabled(); - if (exit == null) { - return; - } - - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return; - } - - final MapLocation mapLocation; - try { - mapLocation = new MapLocation(exit, allowRandomMapParameters); - } catch (final NoExitPathException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitRandomDestination"); - return; - } - - enterMap(mapView, mapLocation.getMapPath(), 0, mapLocation.getMapCoordinate()); + doEnterExit(true); } /** @@ -604,18 +569,7 @@ */ @ActionMethod public void nextExit() { - final MapView<G, A, R> mapView = getNextExitEnabled(); - if (mapView == null) { - return; - } - - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - final Point cursorLocation = mapCursor.getLocation(); - if (cursorLocation == null) { - selectExit(mapView, -1, 0, 1); - } else { - selectExit(mapView, cursorLocation.x, cursorLocation.y, 1); - } + doNextExit(true); } /** @@ -623,19 +577,7 @@ */ @ActionMethod public void prevExit() { - final MapView<G, A, R> mapView = getPrevExitEnabled(); - if (mapView == null) { - return; - } - - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - final Point cursorLocation = mapCursor.getLocation(); - if (cursorLocation == null) { - final Size2D mapSize = mapView.getMapControl().getMapModel().getMapSize(); - selectExit(mapView, mapSize.getWidth(), mapSize.getHeight() - 1, -1); - } else { - selectExit(mapView, cursorLocation.x, cursorLocation.y, -1); - } + doPrevExit(true); } /** @@ -690,7 +632,7 @@ */ @ActionMethod public void enterNorthMap() { - enterMap(CommonConstants.NORTH); + doEnterMap(true, CommonConstants.NORTH); } /** @@ -698,7 +640,7 @@ */ @ActionMethod public void enterNorthEastMap() { - enterMap(CommonConstants.NORTH_EAST); + doEnterMap(true, CommonConstants.NORTH_EAST); } /** @@ -706,7 +648,7 @@ */ @ActionMethod public void enterEastMap() { - enterMap(CommonConstants.EAST); + doEnterMap(true, CommonConstants.EAST); } /** @@ -714,7 +656,7 @@ */ @ActionMethod public void enterSouthEastMap() { - enterMap(CommonConstants.SOUTH_EAST); + doEnterMap(true, CommonConstants.SOUTH_EAST); } /** @@ -722,7 +664,7 @@ */ @ActionMethod public void enterSouthMap() { - enterMap(CommonConstants.SOUTH); + doEnterMap(true, CommonConstants.SOUTH); } /** @@ -730,7 +672,7 @@ */ @ActionMethod public void enterSouthWestMap() { - enterMap(CommonConstants.SOUTH_WEST); + doEnterMap(true, CommonConstants.SOUTH_WEST); } /** @@ -738,7 +680,7 @@ */ @ActionMethod public void enterWestMap() { - enterMap(CommonConstants.WEST); + doEnterMap(true, CommonConstants.WEST); } /** @@ -746,7 +688,7 @@ */ @ActionMethod public void enterNorthWestMap() { - enterMap(CommonConstants.NORTH_WEST); + doEnterMap(true, CommonConstants.NORTH_WEST); } /** @@ -754,75 +696,37 @@ */ @ActionMethod public void deleteUnknownObjects() { - final MapView<G, A, R> mapView = getDeleteUnknownObjectsEnabled(); - if (mapView == null) { - return; - } - - final MapControl<G, A, R> mapControl = mapView.getMapControl(); - final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - final Collection<G> gameObjectsToDelete = new ArrayList<G>(); - for (final Iterable<G> mapSquare : mapModel) { - for (final G gameObject : mapSquare) { - if (gameObject.isHead() && gameObject.hasUndefinedArchetype()) { - gameObjectsToDelete.add(gameObject); - } - } - } - if (!gameObjectsToDelete.isEmpty()) { - mapModel.beginTransaction("delete undefined objects"); - try { - for (final G gameObject : gameObjectsToDelete) { - mapModel.removeGameObject(gameObject, false); - } - } finally { - mapModel.endTransaction(); - } - } + doDeleteUnknownObjects(true); } /** - * Try to load the map where the specified map-tile path points to. Usually - * this method can only be invoked when such a path exists. - * @param direction the direction to go - */ - private void enterMap(final int direction) { - final Destination<G, A, R> destination = getEnterMapEnabled(direction); - if (destination == null) { - return; - } - - final String path = destination.getPath(); - enterMap(destination.getMapView(), path, direction, null); - } - - /** * Enter a map wanted. * @param currentMapView the map view to leave * @param path path to map that should be loaded * @param direction the direction to go * @param destinationPoint the desired destination point on the map (pass * 0|0 if unknown, and note that the point gets modified) + * @return whether the desination map has been entered */ - private void enterMap(@NotNull final MapView<G, A, R> currentMapView, @NotNull final String path, final int direction, @Nullable final Point destinationPoint) { + private boolean enterMap(@NotNull final MapView<G, A, R> currentMapView, @NotNull final String path, final int direction, @Nullable final Point destinationPoint) { final File canonicalNewFile; try { canonicalNewFile = mapPathNormalizer.normalizeMapPath(currentMapView.getMapControl().getMapModel(), path); } catch (final InvalidPathException ex) { ACTION_BUILDER.showMessageDialog(parent, "enterExitInvalidPath", ex.getFile().getAbsolutePath()); - return; + return false; } catch (final IOErrorException ex) { ACTION_BUILDER.showMessageDialog(parent, "enterTileIOException", ex.getFile().getAbsolutePath()); - return; + return false; } catch (final RelativePathOnUnsavedMapException ex) { ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved"); - return; + return false; } catch (final SameMapException e) { // path points to the same map if (destinationPoint != null) { showLocation(currentMapView, destinationPoint); } - return; + return true; } final MapView<G, A, R> newMapView; @@ -830,7 +734,7 @@ newMapView = mapViewsManager.openMapFileWithView(canonicalNewFile, null); } catch (final IOException ex) { fileControl.reportLoadError(canonicalNewFile, ex.getMessage()); - return; + return false; } if (destinationPoint != null) { @@ -843,6 +747,8 @@ // only close current map if a new file was opened and user wants to close it mapViewsManager.closeMapView(currentMapView); } + + return true; } /** @@ -861,173 +767,29 @@ } /** - * Determine whether "grid visible" is enabled. - * @return whether "grid visible" is disabled - */ - private boolean isGridVisibleEnabled() { - return true; - } - - /** - * Determine whether "smoothing" is enabled. - * @return whether "smoothing" is disabled - */ - private boolean isSmoothingEnabled() { - return true; - } - - /** - * Determine whether "draw double faces" is enabled. - * @return whether "draw double faces" is disabled - */ - private boolean isDoubleFacesEnabled() { - return true; - } - - /** - * Determine whether "autojoin" is enabled. - * @return whether "autojoin" is disabled - */ - private boolean isAutojoinEnabled() { - return true; - } - - /** - * Determine whether "tile show" is enabled. - * @return the current map, or <code>null</code> if "tile show" is disabled - */ - @Nullable - private MapControl<G, A, R> getTileShowEnabled() { - return null; //currentMapListener.getCurrentMapControl(); - } - - /** - * Determine whether "create view" is enabled. - * @return the current map, or <code>null</code> if "create view" is - * disabled - */ - @Nullable - private MapView<G, A, R> getCreateViewEnabled() { - return currentMapView; - } - - /** - * Determine whether "map properties" is enabled. - * @return the current map view, or <code>null</code> if "map properties" is - * disabled - */ - @Nullable - private MapView<G, A, R> getMapPropertiesEnabled() { - return currentMapView; - } - - /** - * Determine whether "shrink map size" is enabled. - * @return the current map view, or <code>null</code> if "shrink map size" - * is disabled - */ - @Nullable - private MapView<G, A, R> getShrinkMapSizeEnabled() { - return currentMapView; - } - - /** - * Determine whether "enter exit" is enabled. - * @return the exit to enter, or <code>null</code> if "enter exit" is - * disabled - */ - @Nullable - private GameObject<G, A, R> getEnterExitEnabled() { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return null; - } - - final GameObject<G, A, R> selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); - if (selectedExit != null) { - return selectedExit; - } - - final GameObject<G, A, R> cursorExit = exitMatcher.getValidExit(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getMapCursor().getLocation()); - if (cursorExit != null) { - return cursorExit; - } - - return null; - } - - /** - * Determines whether "next exit" is enabled. - * @return the map view if "next exit" is enabled - */ - @Nullable - private MapView<G, A, R> getNextExitEnabled() { - return currentMapView; - } - - /** - * Determines whether "previous exit" is enabled. - * @return the map view if "previous exit" is enabled - */ - @Nullable - private MapView<G, A, R> getPrevExitEnabled() { - return currentMapView; - } - - /** - * Determines whether "delete unknown objects" is enabled. - * @return the map view if "delete unknown objects" is enabled - */ - @Nullable - private MapView<G, A, R> getDeleteUnknownObjectsEnabled() { - return currentMapView; - } - - /** - * Determine whether "enter xxx map" is enabled. - * @param direction the direction to go - * @return the destination map, or <code>null</code> if "enter xxx map" is - * disabled - */ - @Nullable - private Destination<G, A, R> getEnterMapEnabled(final int direction) { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return null; - } - - final String path = mapView.getMapControl().getMapModel().getMapArchObject().getTilePath(direction); - if (path.length() == 0) { - return null; - } - - return new Destination<G, A, R>(mapView, path); - } - - /** * Update the actions' state. */ private void updateActions() { - aGridVisible.setEnabled(isGridVisibleEnabled()); - aGridVisible.setSelected(mapViewSettings.isGridVisible()); - aSmoothing.setEnabled(isSmoothingEnabled()); - aSmoothing.setSelected(mapViewSettings.isSmoothing()); - aDoubleFaces.setEnabled(isDoubleFacesEnabled()); - aDoubleFaces.setSelected(mapViewSettings.isDoubleFaces()); - aTileShow.setEnabled(getTileShowEnabled() != null); + aGridVisible.setEnabled(doGridVisible(false, false)); + aGridVisible.setSelected(isGridVisible()); + aSmoothing.setEnabled(doSmoothing(false, false)); + aSmoothing.setSelected(isSmoothing()); + aDoubleFaces.setEnabled(doDoubleFaces(false, false)); + aDoubleFaces.setSelected(isDoubleFaces()); + aTileShow.setEnabled(doTileShow(false, false)); aTileShow.setSelected(isTileShow()); - aMapCreateView.setEnabled(getCreateViewEnabled() != null); - aMapProperties.setEnabled(getMapPropertiesEnabled() != null); - aAutoJoin.setEnabled(isAutojoinEnabled()); - aAutoJoin.setSelected(mapViewSettings.isAutojoin()); - aEnterExit.setEnabled(getEnterExitEnabled() != null); - aNextExit.setEnabled(getNextExitEnabled() != null); - aPrevExit.setEnabled(getPrevExitEnabled() != null); - aDeleteUnknownObjects.setEnabled(getDeleteUnknownObjectsEnabled() != null); + aMapCreateView.setEnabled(doMapCreateView(false)); + aMapProperties.setEnabled(doMapProperties(false)); + aAutoJoin.setEnabled(doAutoJoin(false, false)); + aAutoJoin.setSelected(isAutoJoin()); + aEnterExit.setEnabled(doEnterExit(false)); + aNextExit.setEnabled(doNextExit(false)); + aPrevExit.setEnabled(doPrevExit(false)); + aDeleteUnknownObjects.setEnabled(doDeleteUnknownObjects(false)); for (int i = 0; i < directionsDir.length; i++) { - aDirections[i].setEnabled(getEnterMapEnabled(directionsDir[i]) != null); + aDirections[i].setEnabled(doEnterMap(false, directionsDir[i])); } - aShrinkMapSize.setEnabled(getShrinkMapSizeEnabled() != null); + aShrinkMapSize.setEnabled(doShrinkMapSize(false)); } /** @@ -1096,50 +858,282 @@ } /** - * Describes the destination of a "enter xxx map" action. + * Executes the "grid visible" action. + * @param performAction whether the action should be performed + * @param gridVisible whether the grid should be visible; ignored unless + * <code>performAction</code> is set + * @return whether the action was or can be performed */ - private static class Destination<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + private boolean doGridVisible(final boolean performAction, final boolean gridVisible) { + if (performAction) { + mapViewSettings.setGridVisible(gridVisible); + } - /** - * The source map to leave. - */ - @NotNull - private final MapView<G, A, R> mapView; + return true; + } - /** - * The destination map path to enter. - */ - @NotNull - private final String path; + /** + * Executes the "smoothing" action. + * @param performAction whether the action should be performed + * @param smoothing whether smoothing should be performed; ignored unless + * <code>performAction</code> is set + * @return whether the action was or can be performed + */ + private boolean doSmoothing(final boolean performAction, final boolean smoothing) { + if (performAction) { + mapViewSettings.setSmoothing(smoothing); + } - /** - * Create a new instance. - * @param mapView the source map to leave - * @param path the destination map path to enter - */ - Destination(@NotNull final MapView<G, A, R> mapView, @NotNull final String path) { - this.mapView = mapView; - this.path = path; + return true; + } + + /** + * Executes the "double faces" action. + * @param performAction whether the action should be performed + * @param doubleFaces whether double faces should be shown; ignored unless + * <code>performAction</code> is set + * @return whether the action was or can be performed + */ + private boolean doDoubleFaces(final boolean performAction, final boolean doubleFaces) { + if (performAction) { + mapViewSettings.setDoubleFaces(doubleFaces); } - /** - * Return the source map to leave. - * @return the source map to leave - */ - @NotNull - public MapView<G, A, R> getMapView() { - return mapView; + return true; + } + + /** + * Executes the "tile show" action. + * @param performAction whether the action should be performed + * @param tileShow whether adjacent tiles should be shown; ignored unless + * <code>performAction</code> is set + * @return whether the action was or can be performed + * @noinspection MethodMayBeStatic,UnusedDeclaration // not yet implemented + */ + private boolean doTileShow(final boolean performAction, final boolean tileShow) { + return false; // XXX: not yet implemented + } + + /** + * Executes the "map create view" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doMapCreateView(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; } - /** - * Return the destination map path to enter. - * @return the destination map path to enter - */ - @NotNull - public String getPath() { - return path; + if (performAction) { + mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getViewport().getViewPosition()); } - } // class Destination + return true; + } + /** + * Executes the "map properties" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doMapProperties(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapView.getMapControl().getMapModel(), mapFileFilter); + } + + return true; + } + + /** + * Executes the "auto join" action. + * @param performAction whether the action should be performed + * @param autoJoin whether autojoin should be enabled; ignored unless + * <code>performAction</code> is set + * @return whether the action was or can be performed + */ + private boolean doAutoJoin(final boolean performAction, final boolean autoJoin) { + if (performAction) { + mapViewSettings.setAutojoin(autoJoin); + } + + return true; + } + + /** + * Executes the "enter exit" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doEnterExit(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final GameObject<G, A, R> exit; + final GameObject<G, A, R> selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); + if (selectedExit == null) { + final GameObject<G, A, R> cursorExit = exitMatcher.getValidExit(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getMapCursor().getLocation()); + if (cursorExit == null) { + return false; + } + + exit = cursorExit; + } else { + exit = selectedExit; + } + + if (performAction) { + final MapLocation mapLocation; + try { + mapLocation = new MapLocation(exit, allowRandomMapParameters); + } catch (final NoExitPathException ex) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitRandomDestination"); + return false; + } + + if (!enterMap(mapView, mapLocation.getMapPath(), 0, mapLocation.getMapCoordinate())) { + return false; + } + } + + return true; + } + + /** + * Executes the "next exit" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doNextExit(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final Point cursorLocation = mapCursor.getLocation(); + if (cursorLocation == null) { + selectExit(mapView, -1, 0, 1); + } else { + selectExit(mapView, cursorLocation.x, cursorLocation.y, 1); + } + } + + return true; + } + + /** + * Executes the "prev exit" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doPrevExit(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + final Point cursorLocation = mapCursor.getLocation(); + if (cursorLocation == null) { + final Size2D mapSize = mapView.getMapControl().getMapModel().getMapSize(); + selectExit(mapView, mapSize.getWidth(), mapSize.getHeight() - 1, -1); + } else { + selectExit(mapView, cursorLocation.x, cursorLocation.y, -1); + } + } + + return true; + } + + /** + * Executes the "delete unknown objects" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doDeleteUnknownObjects(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + final MapControl<G, A, R> mapControl = mapView.getMapControl(); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + final Collection<G> gameObjectsToDelete = new ArrayList<G>(); + for (final Iterable<G> mapSquare : mapModel) { + for (final G gameObject : mapSquare) { + if (gameObject.isHead() && gameObject.hasUndefinedArchetype()) { + gameObjectsToDelete.add(gameObject); + } + } + } + if (!gameObjectsToDelete.isEmpty()) { + mapModel.beginTransaction("delete undefined objects"); + try { + for (final G gameObject : gameObjectsToDelete) { + mapModel.removeGameObject(gameObject, false); + } + } finally { + mapModel.endTransaction(); + } + } + } + + return true; + } + + /** + * Executes the "enter map" action. + * @param performAction whether the action should be performed + * @param direction the direction to enter + * @return whether the action was or can be performed + */ + private boolean doEnterMap(final boolean performAction, final int direction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final String path = mapView.getMapControl().getMapModel().getMapArchObject().getTilePath(direction); + if (path.length() == 0) { + return false; + } + + if (performAction) { + if (!enterMap(mapView, path, direction, null)) { + return false; + } + } + + return true; + } + + /** + * Executes the "shrink map size" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doShrinkMapSize(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + shrinkMapSizeDialogManager.showDialog(mapView); + } + + return true; + } + } // class MapActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:11:32
|
Revision: 7904 http://gridarta.svn.sourceforge.net/gridarta/?rev=7904&view=rev Author: akirschbaum Date: 2010-05-23 10:11:24 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove empty MapActions; rename DefaultMapActions to MapActions. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2010-05-23 10:06:20 UTC (rev 7903) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2010-05-23 10:11:24 UTC (rev 7904) @@ -1,1145 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapactions; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import javax.swing.Action; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.cursor.MapCursor; -import net.sf.gridarta.gui.map.cursor.MapCursorEvent; -import net.sf.gridarta.gui.map.cursor.MapCursorListener; -import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewManager; -import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; -import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; -import net.sf.gridarta.gui.shrinkmapsizedialog.ShrinkMapSizeDialogManager; -import net.sf.gridarta.mapmanager.FileControl; -import net.sf.gridarta.mapmanager.MapManager; -import net.sf.gridarta.mapmanager.MapManagerListener; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.exitconnector.ExitMatcher; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapcontrol.MapControl; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.IOErrorException; -import net.sf.gridarta.model.map.normalizer.InvalidPathException; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; -import net.sf.gridarta.model.map.normalizer.RelativePathOnUnsavedMapException; -import net.sf.gridarta.model.map.normalizer.SameMapException; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.mapviewsettings.MapViewSettingsListener; -import net.sf.gridarta.utils.ActionUtils; -import net.sf.gridarta.utils.CommonConstants; -import net.sf.gridarta.utils.Size2D; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.action.ActionMethod; -import net.sf.japi.swing.action.ToggleAction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Manages actions in the "map" menu. - * @author Andreas Kirschbaum - */ -public class DefaultMapActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapActions { - - /** - * Action Builder to create Actions. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * Possible directions for "enter xxx map". - */ - @NotNull - private final String[] directionsMap = { "enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterNorthEastMap", "enterSouthEastMap", "enterSouthWestMap", "enterNorthWestMap" }; - - /** - * Possible directions for "enter xxx map". - */ - @NotNull - private final int[] directionsDir = { CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST }; - - /** - * Action for "grid visible". - */ - @NotNull - private final ToggleAction aGridVisible = (ToggleAction) ACTION_BUILDER.createToggle(true, "gridVisible", this); - - /** - * Action for "smoothing". - */ - @NotNull - private final ToggleAction aSmoothing = (ToggleAction) ACTION_BUILDER.createToggle(true, "smoothing", this); - - /** - * Action for "draw double faces". - */ - @NotNull - private final ToggleAction aDoubleFaces = (ToggleAction) ACTION_BUILDER.createToggle(true, "doubleFaces", this); - - /** - * Action for "tile show". - */ - @NotNull - private final ToggleAction aTileShow = (ToggleAction) ACTION_BUILDER.createToggle(true, "tileShow", this); - - /** - * Action for "create view". - */ - @NotNull - private final Action aMapCreateView = ActionUtils.newAction(ACTION_BUILDER, "Map,Window", this, "mapCreateView"); - - /** - * Action for "map properties". - */ - @NotNull - private final Action aMapProperties = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "mapProperties"); - - /** - * Action for "autojoin". - */ - @NotNull - private final ToggleAction aAutoJoin = (ToggleAction) ACTION_BUILDER.createToggle(true, "autoJoin", this); - - /** - * Action for "shrink map size". - */ - @NotNull - private final Action aShrinkMapSize = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "shrinkMapSize"); - - /** - * Action for "enter exit". - */ - @NotNull - private final Action aEnterExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "enterExit"); - - /** - * Action for "next exit". - */ - @NotNull - private final Action aNextExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "nextExit"); - - /** - * Action for "previous exit". - */ - @NotNull - private final Action aPrevExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "prevExit"); - - /** - * Action for "delete unknown objects". - */ - @NotNull - private final Action aDeleteUnknownObjects = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "deleteUnknownObjects"); - - /** - * Action for "enter xxx map". - */ - @NotNull - private final Action[] aDirections = new Action[directionsMap.length]; - - { - for (int i = 0; i < directionsMap.length; i++) { - aDirections[i] = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, directionsMap[i]); - } - } - - /** - * The component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** - * The parent frame for help windows. - */ - @NotNull - private final JFrame helpParent; - - /** - * The {@link ExitMatcher} for selecting exit game objects. - */ - @NotNull - private final ExitMatcher<G, A, R> exitMatcher; - - /** - * The Swing file filter to use. - */ - @NotNull - private final FileFilter mapFileFilter; - - /** - * The {@link SelectedSquareModel} to use. - */ - @NotNull - private final SelectedSquareModel<G, A, R> selectedSquareModel; - - /** - * The {@link ShrinkMapSizeDialogManager} instance. - */ - @NotNull - private final ShrinkMapSizeDialogManager<G, A, R> shrinkMapSizeDialogManager; - - /** - * Maps map relative direction to map window direction. - */ - @NotNull - private final int[] directionMap; - - /** - * Whether exit paths may point to random maps. - */ - private final boolean allowRandomMapParameters; - - /** - * The {@link MapPropertiesDialogFactory} to use. - */ - @NotNull - private final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory; - - /** - * The {@link MapViewSettings} instance to use. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** - * The {@link MapPathNormalizer} to use. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** - * The {@link MapViewsManager}. - */ - @NotNull - private final MapViewsManager<G, A, R> mapViewsManager; - - /** - * The {@link FileControl}. - */ - @NotNull - private final FileControl<G, A, R> fileControl; - - /** - * The current map view, or <code>null</code> if no map view is active. - */ - @Nullable - private MapView<G, A, R> currentMapView; - - /** - * The {@link MapViewSettingsListener} attached to {@link - * #mapViewSettings}. - */ - private final MapViewSettingsListener mapViewSettingsListener = new MapViewSettingsListener() { - - /** {@inheritDoc} */ - @Override - public void gridVisibleChanged(final boolean gridVisible) { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void smoothingChanged(final boolean smoothing) { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void doubleFacesChanged(final boolean doubleFaces) { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void alphaTypeChanged(final int alphaType) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void editTypeChanged(final int editType) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void autojoinChanged(final boolean autojoin) { - updateActions(); - } - - }; - - /** - * The map manager listener which is attached to the current map if the - * current map is tracked. Otherwise it is unused. - */ - private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { - // ignore - } - - }; - - /** - * The map view manager listener which is attached to the current map if the - * current map is tracked. Otherwise it is unused. - */ - private final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { - if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); - } - currentMapView = mapView; - if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); - } - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - // ignore - } - - }; - - /** - * The map cursor listener which is attached to {@link #currentMapView}. - */ - private final MapCursorListener mapCursorListener = new MapCursorListener() { - - /** {@inheritDoc} */ - @Override - public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { - // ignore - } - - }; - - /** - * Create a new instance. - * @param parent the component for showing dialog boxes - * @param helpParent the parent frame for help windows - * @param mapManager the map manager - * @param mapViewManager the map view manager - * @param exitMatcher the exit matcher for selecting exit game objects - * @param mapFileFilter the Swing file filter to use - * @param selectedSquareModel the selected square model to use - * @param directionMap maps relative direction to map window direction - * @param allowRandomMapParameters whether exit paths may point to random - * maps - * @param mapPropertiesDialogFactory the map properties dialog factory to - * use - * @param mapViewSettings the map view settings instance to use - * @param mapPathNormalizer the map path normalizer to use - * @param mapViewsManager the map views - * @param fileControl the file control - */ - public DefaultMapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final FileControl<G, A, R> fileControl) { - this.parent = parent; - this.helpParent = helpParent; - this.exitMatcher = exitMatcher; - this.mapFileFilter = mapFileFilter; - this.selectedSquareModel = selectedSquareModel; - this.directionMap = directionMap; - this.allowRandomMapParameters = allowRandomMapParameters; - this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; - this.mapViewSettings = mapViewSettings; - this.mapPathNormalizer = mapPathNormalizer; - this.mapViewsManager = mapViewsManager; - this.fileControl = fileControl; - shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<G, A, R>(mapViewManager); - mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener); - - mapManager.addMapManagerListener(mapManagerListener); - mapViewManager.addMapViewManagerListener(mapViewManagerListener); - currentMapView = mapViewManager.getActiveMapView(); - if (currentMapView != null) { - currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); - } - - updateActions(); - } - - /** - * Action method for "grid visible". - * @return <code>true</code> if the grid is visible, or <code>false</code> - * if the grid is invisible - */ - @ActionMethod - public boolean isGridVisible() { - return isGridVisibleEnabled() && mapViewSettings.isGridVisible(); - } - - /** - * Sets whether the grid of the current map should be visible. - * @param gridVisible new visibility of grid in current map, - * <code>true</code> if the grid should be visible, <code>false</code> if - * invisible - * @see #isGridVisible() - */ - @ActionMethod - public void setGridVisible(final boolean gridVisible) { - if (isGridVisibleEnabled()) { - mapViewSettings.setGridVisible(gridVisible); - } - } - - /** - * Action method for "smoothing". - * @return <code>true</code> if smoothing is active, or <code>false</code> - * if smoothing is disabled - */ - @ActionMethod - public boolean isSmoothing() { - return isSmoothingEnabled() && mapViewSettings.isSmoothing(); - } - - /** - * Sets whether smoothing of the current map is active. - * @param smoothing new smoothing in current map, <code>true</code> if the - * smoothing should be active, <code>false</code> if deactivated - * @see #isSmoothing() () - */ - @ActionMethod - public void setSmoothing(final boolean smoothing) { - if (isSmoothingEnabled()) { - mapViewSettings.setSmoothing(smoothing); - } - } - - /** - * Action method for "double faces". - * @return <code>true</code> if double faces are shwon, or - * <code>false</code> if not - */ - @ActionMethod - public boolean isDoubleFaces() { - return isDoubleFacesEnabled() && mapViewSettings.isDoubleFaces(); - } - - /** - * Sets whether double faces on the current map should be shown. - * @param doubleFaces new value - * @see #isDoubleFaces() - */ - @ActionMethod - public void setDoubleFaces(final boolean doubleFaces) { - if (isDoubleFacesEnabled()) { - mapViewSettings.setDoubleFaces(doubleFaces); - } - } - - /** - * Action method for "tile show". - * @return <code>true</code> if adjacent tiles are shown, or - * <code>false</code> if adjacent tiles are not shown - */ - @ActionMethod - public boolean isTileShow() { - return false; - } - - /** - * Action method for "tile show". - * @param tileShow if set, show adjacent tiles - */ - @ActionMethod - public void setTileShow(final boolean tileShow) { - // not yet implemented - } - - /** - * Action method for "create view". - */ - @ActionMethod - public void mapCreateView() { - final MapView<G, A, R> mapView = getCreateViewEnabled(); - if (mapView != null) { - mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getViewport().getViewPosition()); - } - } - - /** - * Action method for "map properties". - */ - @ActionMethod - public void mapProperties() { - final MapView<G, A, R> mapView = getMapPropertiesEnabled(); - if (mapView != null) { - mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapView.getMapControl().getMapModel(), mapFileFilter); - } - } - - /** - * Action method for "shrink map size". - */ - @ActionMethod - public void shrinkMapSize() { - final MapView<G, A, R> mapView = getShrinkMapSizeEnabled(); - if (mapView != null) { - shrinkMapSizeDialogManager.showDialog(mapView); - } - } - - /** - * Action method for "autojoin". - * @return <code>true</code> if autojoining is enabled, or - * <code>false</code> if autojoining is disabled - */ - @ActionMethod - public boolean isAutoJoin() { - return mapViewSettings.isAutojoin(); - } - - /** - * Action method for "autojoin". - * @param autojoin if set, enable autojoining - */ - @ActionMethod - public void setAutoJoin(final boolean autojoin) { - if (isAutojoinEnabled()) { - mapViewSettings.setAutojoin(autojoin); - } - } - - /** - * Try to load the map where the selected map-exit points to. - */ - @ActionMethod - public void enterExit() { - final GameObject<G, A, R> exit = getEnterExitEnabled(); - if (exit == null) { - return; - } - - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return; - } - - final MapLocation mapLocation; - try { - mapLocation = new MapLocation(exit, allowRandomMapParameters); - } catch (final NoExitPathException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitRandomDestination"); - return; - } - - enterMap(mapView, mapLocation.getMapPath(), 0, mapLocation.getMapCoordinate()); - } - - /** - * Select the next exit. - */ - @ActionMethod - public void nextExit() { - final MapView<G, A, R> mapView = getNextExitEnabled(); - if (mapView == null) { - return; - } - - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - final Point cursorLocation = mapCursor.getLocation(); - if (cursorLocation == null) { - selectExit(mapView, -1, 0, 1); - } else { - selectExit(mapView, cursorLocation.x, cursorLocation.y, 1); - } - } - - /** - * Select the previous exit. - */ - @ActionMethod - public void prevExit() { - final MapView<G, A, R> mapView = getPrevExitEnabled(); - if (mapView == null) { - return; - } - - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - final Point cursorLocation = mapCursor.getLocation(); - if (cursorLocation == null) { - final Size2D mapSize = mapView.getMapControl().getMapModel().getMapSize(); - selectExit(mapView, mapSize.getWidth(), mapSize.getHeight() - 1, -1); - } else { - selectExit(mapView, cursorLocation.x, cursorLocation.y, -1); - } - } - - /** - * Selects an exit square. - * @param mapView the map view to operate on - * @param xStart the x-coordinate to start searching - * @param yStart the y-coordinate to start searching - * @param direction the direction to search - */ - private void selectExit(@NotNull final MapView<G, A, R> mapView, final int xStart, final int yStart, final int direction) { - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); - final Size2D mapSize = mapModel.getMapSize(); - final int width = mapSize.getWidth(); - final int height = mapSize.getHeight(); - final Point point = new Point(xStart, yStart); - final G currentExit = exitMatcher.getValidExit(mapModel, point); - for (int i = width * height; i > 0; i--) { - if (direction > 0) { - point.x++; - if (point.x >= width) { - point.x = 0; - point.y++; - if (point.y >= height) { - point.y = 0; - } - } - } else { - point.x--; - if (point.x < 0) { - point.x = width - 1; - point.y--; - if (point.y < 0) { - point.y = height - 1; - } - } - } - - final G exit = exitMatcher.getValidExit(mapModel, point); - if (exit != null && exit != currentExit) { - mapCursor.setLocation(point); - return; - } - } - if (currentExit == null) { - mapCursor.setLocation(null); - } - } - - /** - * Action method for entering the north map. - */ - @ActionMethod - public void enterNorthMap() { - enterMap(CommonConstants.NORTH); - } - - /** - * Action method for entering the north east map. - */ - @ActionMethod - public void enterNorthEastMap() { - enterMap(CommonConstants.NORTH_EAST); - } - - /** - * Action method for entering the east map. - */ - @ActionMethod - public void enterEastMap() { - enterMap(CommonConstants.EAST); - } - - /** - * Action method for entering the south east map. - */ - @ActionMethod - public void enterSouthEastMap() { - enterMap(CommonConstants.SOUTH_EAST); - } - - /** - * Action method for entering the south map. - */ - @ActionMethod - public void enterSouthMap() { - enterMap(CommonConstants.SOUTH); - } - - /** - * Action method for entering the south west map. - */ - @ActionMethod - public void enterSouthWestMap() { - enterMap(CommonConstants.SOUTH_WEST); - } - - /** - * Action method for entering the west map. - */ - @ActionMethod - public void enterWestMap() { - enterMap(CommonConstants.WEST); - } - - /** - * Action method for entering the north west map. - */ - @ActionMethod - public void enterNorthWestMap() { - enterMap(CommonConstants.NORTH_WEST); - } - - /** - * Deletes all game objects referencing unknown archetypes. - */ - @ActionMethod - public void deleteUnknownObjects() { - final MapView<G, A, R> mapView = getDeleteUnknownObjectsEnabled(); - if (mapView == null) { - return; - } - - final MapControl<G, A, R> mapControl = mapView.getMapControl(); - final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - final Collection<G> gameObjectsToDelete = new ArrayList<G>(); - for (final Iterable<G> mapSquare : mapModel) { - for (final G gameObject : mapSquare) { - if (gameObject.isHead() && gameObject.hasUndefinedArchetype()) { - gameObjectsToDelete.add(gameObject); - } - } - } - if (!gameObjectsToDelete.isEmpty()) { - mapModel.beginTransaction("delete undefined objects"); - try { - for (final G gameObject : gameObjectsToDelete) { - mapModel.removeGameObject(gameObject, false); - } - } finally { - mapModel.endTransaction(); - } - } - } - - /** - * Try to load the map where the specified map-tile path points to. Usually - * this method can only be invoked when such a path exists. - * @param direction the direction to go - */ - private void enterMap(final int direction) { - final Destination<G, A, R> destination = getEnterMapEnabled(direction); - if (destination == null) { - return; - } - - final String path = destination.getPath(); - enterMap(destination.getMapView(), path, direction, null); - } - - /** - * Enter a map wanted. - * @param currentMapView the map view to leave - * @param path path to map that should be loaded - * @param direction the direction to go - * @param destinationPoint the desired destination point on the map (pass - * 0|0 if unknown, and note that the point gets modified) - */ - private void enterMap(@NotNull final MapView<G, A, R> currentMapView, @NotNull final String path, final int direction, @Nullable final Point destinationPoint) { - final File canonicalNewFile; - try { - canonicalNewFile = mapPathNormalizer.normalizeMapPath(currentMapView.getMapControl().getMapModel(), path); - } catch (final InvalidPathException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitInvalidPath", ex.getFile().getAbsolutePath()); - return; - } catch (final IOErrorException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterTileIOException", ex.getFile().getAbsolutePath()); - return; - } catch (final RelativePathOnUnsavedMapException ex) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved"); - return; - } catch (final SameMapException e) { - // path points to the same map - if (destinationPoint != null) { - showLocation(currentMapView, destinationPoint); - } - return; - } - - final MapView<G, A, R> newMapView; - try { - newMapView = mapViewsManager.openMapFileWithView(canonicalNewFile, null); - } catch (final IOException ex) { - fileControl.reportLoadError(canonicalNewFile, ex.getMessage()); - return; - } - - if (destinationPoint != null) { - showLocation(newMapView, destinationPoint); - } else { - newMapView.getMapViewBasic().getViewport().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); - } - - if (ACTION_BUILDER.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { - // only close current map if a new file was opened and user wants to close it - mapViewsManager.closeMapView(currentMapView); - } - } - - /** - * Scrolls a map view to make a give tile visible. - * @param mapView the map view - * @param point the square - */ - private void showLocation(@NotNull final MapView<G, A, R> mapView, @NotNull final Point point) { - final Point point2 = point.x == -1 && point.y == -1 ? mapView.getMapControl().getMapModel().getMapArchObject().getEnter() : point; - if (!mapView.getMapControl().getMapModel().isPointValid(point2)) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitOutside"); - return; - } - - mapView.getMapViewBasic().getMapCursor().setLocation(point2); - } - - /** - * Determine whether "grid visible" is enabled. - * @return whether "grid visible" is disabled - */ - private boolean isGridVisibleEnabled() { - return true; - } - - /** - * Determine whether "smoothing" is enabled. - * @return whether "smoothing" is disabled - */ - private boolean isSmoothingEnabled() { - return true; - } - - /** - * Determine whether "draw double faces" is enabled. - * @return whether "draw double faces" is disabled - */ - private boolean isDoubleFacesEnabled() { - return true; - } - - /** - * Determine whether "autojoin" is enabled. - * @return whether "autojoin" is disabled - */ - private boolean isAutojoinEnabled() { - return true; - } - - /** - * Determine whether "tile show" is enabled. - * @return the current map, or <code>null</code> if "tile show" is disabled - */ - @Nullable - private MapControl<G, A, R> getTileShowEnabled() { - return null; //currentMapListener.getCurrentMapControl(); - } - - /** - * Determine whether "create view" is enabled. - * @return the current map, or <code>null</code> if "create view" is - * disabled - */ - @Nullable - private MapView<G, A, R> getCreateViewEnabled() { - return currentMapView; - } - - /** - * Determine whether "map properties" is enabled. - * @return the current map view, or <code>null</code> if "map properties" is - * disabled - */ - @Nullable - private MapView<G, A, R> getMapPropertiesEnabled() { - return currentMapView; - } - - /** - * Determine whether "shrink map size" is enabled. - * @return the current map view, or <code>null</code> if "shrink map size" - * is disabled - */ - @Nullable - private MapView<G, A, R> getShrinkMapSizeEnabled() { - return currentMapView; - } - - /** - * Determine whether "enter exit" is enabled. - * @return the exit to enter, or <code>null</code> if "enter exit" is - * disabled - */ - @Nullable - private GameObject<G, A, R> getEnterExitEnabled() { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return null; - } - - final GameObject<G, A, R> selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); - if (selectedExit != null) { - return selectedExit; - } - - final GameObject<G, A, R> cursorExit = exitMatcher.getValidExit(mapView.getMapControl().getMapModel(), mapView.getMapViewBasic().getMapCursor().getLocation()); - if (cursorExit != null) { - return cursorExit; - } - - return null; - } - - /** - * Determines whether "next exit" is enabled. - * @return the map view if "next exit" is enabled - */ - @Nullable - private MapView<G, A, R> getNextExitEnabled() { - return currentMapView; - } - - /** - * Determines whether "previous exit" is enabled. - * @return the map view if "previous exit" is enabled - */ - @Nullable - private MapView<G, A, R> getPrevExitEnabled() { - return currentMapView; - } - - /** - * Determines whether "delete unknown objects" is enabled. - * @return the map view if "delete unknown objects" is enabled - */ - @Nullable - private MapView<G, A, R> getDeleteUnknownObjectsEnabled() { - return currentMapView; - } - - /** - * Determine whether "enter xxx map" is enabled. - * @param direction the direction to go - * @return the destination map, or <code>null</code> if "enter xxx map" is - * disabled - */ - @Nullable - private Destination<G, A, R> getEnterMapEnabled(final int direction) { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return null; - } - - final String path = mapView.getMapControl().getMapModel().getMapArchObject().getTilePath(direction); - if (path.length() == 0) { - return null; - } - - return new Destination<G, A, R>(mapView, path); - } - - /** - * Update the actions' state. - */ - private void updateActions() { - aGridVisible.setEnabled(isGridVisibleEnabled()); - aGridVisible.setSelected(mapViewSettings.isGridVisible()); - aSmoothing.setEnabled(isSmoothingEnabled()); - aSmoothing.setSelected(mapViewSettings.isSmoothing()); - aDoubleFaces.setEnabled(isDoubleFacesEnabled()); - aDoubleFaces.setSelected(mapViewSettings.isDoubleFaces()); - aTileShow.setEnabled(getTileShowEnabled() != null); - aTileShow.setSelected(isTileShow()); - aMapCreateView.setEnabled(getCreateViewEnabled() != null); - aMapProperties.setEnabled(getMapPropertiesEnabled() != null); - aAutoJoin.setEnabled(isAutojoinEnabled()); - aAutoJoin.setSelected(mapViewSettings.isAutojoin()); - aEnterExit.setEnabled(getEnterExitEnabled() != null); - aNextExit.setEnabled(getNextExitEnabled() != null); - aPrevExit.setEnabled(getPrevExitEnabled() != null); - aDeleteUnknownObjects.setEnabled(getDeleteUnknownObjectsEnabled() != null); - for (int i = 0; i < directionsDir.length; i++) { - aDirections[i].setEnabled(getEnterMapEnabled(directionsDir[i]) != null); - } - aShrinkMapSize.setEnabled(getShrinkMapSizeEnabled() != null); - } - - /** - * Calculate the view position for the new viewport. - * @param oldMapView the old map view - * @param newMapView the new map view - * @param direction the direction to scroll - * @return the new view position - */ - @NotNull - private Point calculateNewViewPosition(@NotNull final JScrollPane oldMapView, @NotNull final JScrollPane newMapView, final int direction) { - final Dimension newViewSize = newMapView.getViewport().getViewSize(); - final Rectangle oldViewRect = oldMapView.getViewport().getViewRect(); - - final Rectangle scrollto; // new vieport rect - switch (directionMap[direction]) { - case CommonConstants.SOUTH: - scrollto = new Rectangle(oldViewRect.x, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH: - scrollto = new Rectangle(oldViewRect.x, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.EAST: - scrollto = new Rectangle(0, oldViewRect.y, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, oldViewRect.y, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH_EAST: - scrollto = new Rectangle(0, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.SOUTH_EAST: - scrollto = new Rectangle(0, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.SOUTH_WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH_WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - default: - throw new AssertionError(); - } - - if (scrollto.x + scrollto.width > newViewSize.width) { - scrollto.x = newViewSize.width - scrollto.width; - } - if (scrollto.x < 0) { - scrollto.x = 0; - } - if (scrollto.y + scrollto.height > newViewSize.height) { - scrollto.y = newViewSize.height - scrollto.height; - } - if (scrollto.y < 0) { - scrollto.y = 0; - } - return scrollto.getLocation(); - } - - /** - * Describes the destination of a "enter xxx map" action. - */ - private static class Destination<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * The source map to leave. - */ - @NotNull - private final MapView<G, A, R> mapView; - - /** - * The destination map path to enter. - */ - @NotNull - private final String path; - - /** - * Create a new instance. - * @param mapView the source map to leave - * @param path the destination map path to enter - */ - Destination(@NotNull final MapView<G, A, R> mapView, @NotNull final String path) { - this.mapView = mapView; - this.path = path; - } - - /** - * Return the source map to leave. - * @return the source map to leave - */ - @NotNull - public MapView<G, A, R> getMapView() { - return mapView; - } - - /** - * Return the destination map path to enter. - * @return the destination map path to enter - */ - @NotNull - public String getPath() { - return path; - } - - } // class Destination - -} // class MapActions Deleted: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-23 10:06:20 UTC (rev 7903) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-23 10:11:24 UTC (rev 7904) @@ -1,28 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.map.mapactions; - -/** - * Manages actions in the "map" menu. - * @author Andreas Kirschbaum - */ -public interface MapActions { - -} // interface MapActions Copied: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java (from rev 7896, trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-23 10:11:24 UTC (rev 7904) @@ -0,0 +1,1145 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map.mapactions; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import javax.swing.Action; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.gui.map.cursor.MapCursor; +import net.sf.gridarta.gui.map.cursor.MapCursorEvent; +import net.sf.gridarta.gui.map.cursor.MapCursorListener; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; +import net.sf.gridarta.gui.map.mapview.MapViewsManager; +import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; +import net.sf.gridarta.gui.shrinkmapsizedialog.ShrinkMapSizeDialogManager; +import net.sf.gridarta.mapmanager.FileControl; +import net.sf.gridarta.mapmanager.MapManager; +import net.sf.gridarta.mapmanager.MapManagerListener; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.exitconnector.ExitMatcher; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapcontrol.MapControl; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.map.normalizer.IOErrorException; +import net.sf.gridarta.model.map.normalizer.InvalidPathException; +import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.normalizer.RelativePathOnUnsavedMapException; +import net.sf.gridarta.model.map.normalizer.SameMapException; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.mapviewsettings.MapViewSettingsListener; +import net.sf.gridarta.utils.ActionUtils; +import net.sf.gridarta.utils.CommonConstants; +import net.sf.gridarta.utils.Size2D; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; +import net.sf.japi.swing.action.ToggleAction; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Manages actions in the "map" menu. + * @author Andreas Kirschbaum + */ +public class MapActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Action Builder to create Actions. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * Possible directions for "enter xxx map". + */ + @NotNull + private final String[] directionsMap = { "enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterNorthEastMap", "enterSouthEastMap", "enterSouthWestMap", "enterNorthWestMap" }; + + /** + * Possible directions for "enter xxx map". + */ + @NotNull + private final int[] directionsDir = { CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST }; + + /** + * Action for "grid visible". + */ + @NotNull + private final ToggleAction aGridVisible = (ToggleAction) ACTION_BUILDER.createToggle(true, "gridVisible", this); + + /** + * Action for "smoothing". + */ + @NotNull + private final ToggleAction aSmoothing = (ToggleAction) ACTION_BUILDER.createToggle(true, "smoothing", this); + + /** + * Action for "draw double faces". + */ + @NotNull + private final ToggleAction aDoubleFaces = (ToggleAction) ACTION_BUILDER.createToggle(true, "doubleFaces", this); + + /** + * Action for "tile show". + */ + @NotNull + private final ToggleAction aTileShow = (ToggleAction) ACTION_BUILDER.createToggle(true, "tileShow", this); + + /** + * Action for "create view". + */ + @NotNull + private final Action aMapCreateView = ActionUtils.newAction(ACTION_BUILDER, "Map,Window", this, "mapCreateView"); + + /** + * Action for "map properties". + */ + @NotNull + private final Action aMapProperties = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "mapProperties"); + + /** + * Action for "autojoin". + */ + @NotNull + private final ToggleAction aAutoJoin = (ToggleAction) ACTION_BUILDER.createToggle(true, "autoJoin", this); + + /** + * Action for "shrink map size". + */ + @NotNull + private final Action aShrinkMapSize = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "shrinkMapSize"); + + /** + * Action for "enter exit". + */ + @NotNull + private final Action aEnterExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "enterExit"); + + /** + * Action for "next exit". + */ + @NotNull + private final Action aNextExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "nextExit"); + + /** + * Action for "previous exit". + */ + @NotNull + private final Action aPrevExit = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, "prevExit"); + + /** + * Action for "delete unknown objects". + */ + @NotNull + private final Action aDeleteUnknownObjects = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "deleteUnknownObjects"); + + /** + * Action for "enter xxx map". + */ + @NotNull + private final Action[] aDirections = new Action[directionsMap.length]; + + { + for (int i = 0; i < directionsMap.length; i++) { + aDirections[i] = ActionUtils.newAction(ACTION_BUILDER, "Map Navigation", this, directionsMap[i]); + } + } + + /** + * The component for showing dialog boxes. + */ + @NotNull + private final Component parent; + + /** + * The parent frame for help windows. + */ + @NotNull + private final JFrame helpParent; + + /** + * The {@link ExitMatcher} for selecting exit game objects. + */ + @NotNull + private final ExitMatcher<G, A, R> exitMatcher; + + /** + * The Swing file filter to use. + */ + @NotNull + private final FileFilter mapFileFilter; + + /** + * The {@link SelectedSquareModel} to use. + */ + @NotNull + private final SelectedSquareModel<G, A, R> selectedSquareModel; + + /** + * The {@link ShrinkMapSizeDialogManager} instance. + */ + @NotNull + private final ShrinkMapSizeDialogManager<G, A, R> shrinkMapSizeDialogManager; + + /** + * Maps map relative direction to map window direction. + */ + @NotNull + private final int[] directionMap; + + /** + * Whether exit paths may point to random maps. + */ + private final boolean allowRandomMapParameters; + + /** + * The {@link MapPropertiesDialogFactory} to use. + */ + @NotNull + private final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory; + + /** + * The {@link MapViewSettings} instance to use. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** + * The {@link MapPathNormalizer} to use. + */ + @NotNull + private final MapPathNormalizer mapPathNormalizer; + + /** + * The {@link MapViewsManager}. + */ + @NotNull + private final MapViewsManager<G, A, R> mapViewsManager; + + /** + * The {@link FileControl}. + */ + @NotNull + private final FileControl<G, A, R> fileControl; + + /** + * The current map view, or <code>null</code> if no map view is active. + */ + @Nullable + private MapView<G, A, R> currentMapView; + + /** + * The {@link MapViewSettingsListener} attached to {@link + * #mapViewSettings}. + */ + private final MapViewSettingsListener mapViewSettingsListener = new MapViewSettingsListener() { + + /** {@inheritDoc} */ + @Override + public void gridVisibleChanged(final boolean gridVisible) { + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void smoothingChanged(final boolean smoothing) { + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void doubleFacesChanged(final boolean doubleFaces) { + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void alphaTypeChanged(final int alphaType) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void editTypeChanged(final int editType) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void autojoinChanged(final boolean autojoin) { + updateActions(); + } + + }; + + /** + * The map manager listener which is attached to the current map if the + * current map is tracked. Otherwise it is unused. + */ + private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + }; + + /** + * The map view manager listener which is attached to the current map if the + * current map is tracked. Otherwise it is unused. + */ + private final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { + if (currentMapView != null) { + currentMapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + } + currentMapView = mapView; + if (currentMapView != null) { + currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + } + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { + // ignore + } + + }; + + /** + * The map cursor listener which is attached to {@link #currentMapView}. + */ + private final MapCursorListener mapCursorListener = new MapCursorListener() { + + /** {@inheritDoc} */ + @Override + public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { + updateActions(); + } + + /** {@inheritDoc} */ + @Override + public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { + // ignore + } + + }; + + /** + * Create a new instance. + * @param parent the component for showing dialog boxes + * @param helpParent the parent frame for help windows + * @param mapManager the map manager + * @param mapViewManager the map view manager + * @param exitMatcher the exit matcher for selecting exit game objects + * @param mapFileFilter the Swing file filter to use + * @param selectedSquareModel the selected square model to use + * @param directionMap maps relative direction to map window direction + * @param allowRandomMapParameters whether exit paths may point to random + * maps + * @param mapPropertiesDialogFactory the map properties dialog factory to + * use + * @param mapViewSettings the map view settings instance to use + * @param mapPathNormalizer the map path normalizer to use + * @param mapViewsManager the map views + * @param fileControl the file control + */ + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, final ExitMatcher<G, A, R> exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final FileControl<G, A, R> fileControl) { + this.parent = parent; + this.helpParent = helpParent; + this.exitMatcher = exitMatcher; + this.mapFileFilter = mapFileFilter; + this.selectedSquareModel = selectedSquareModel; + this.directionMap = directionMap; + this.allowRandomMapParameters = allowRandomMapParameters; + this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; + this.mapViewSettings = mapViewSettings; + this.mapPathNormalizer = mapPathNormalizer; + this.mapViewsManager = mapViewsManager; + this.fileControl = fileControl; + shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<G, A, R>(mapViewManager); + mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener); + + mapManager.addMapManagerListener(mapManagerListener); + mapViewManager.addMapViewManagerListener(mapViewManagerListener); + currentMapView = mapViewManager.getActiveMapView(); + if (currentMapView != null) { + currentMapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + } + + updateActions(); + } + + /** + * Action method for "grid visible". + * @return <code>true</code> if the grid is visible, or <code>false</code> + * if the grid is invisible + */ + @ActionMethod + public boolean isGridVisible() { + return isGridVisibleEnabled() && mapViewSettings.isGridVisible(); + } + + /** + * Sets whether the grid of the current map should be visible. + * @param gridVisible new visibility of grid in current map, + * <code>true</code> if the grid should be visible, <code>false</code> if + * invisible + * @see #isGridVisible() + */ + @ActionMethod + public void setGridVisible(final boolean gridVisible) { + if (isGridVisibleEnabled()) { + mapViewSettings.setGridVisible(gridVisible); + } + } + + /** + * Action method for "smoothing". + * @return <code>true</code> if smoothing is active, or <code>false</code> + * if smoothing is disabled + */ + @ActionMethod + public boolean isSmoothing() { + return isSmoothingEnabled() && mapViewSettings.isSmoothing(); + } + + /** + * Sets whether smoothing of the current map is active. + * @param smoothing new smoothing in current map, <code>true</code> if the + * smoothing should be active, <code>false</code> if deactivated + * @see #isSmoothing() () + */ + @ActionMethod + public void setSmoothing(final boolean smoothing) { + if (isSmoothingEnabled()) { + mapViewSettings.setSmoothing(smoothing); + } + } + + /** + * Action method for "double faces". + * @return <code>true</code> if double faces are shwon, or + * <code>false</code> if not + */ + @ActionMethod + public boolean isDoubleFaces() { + return isDoubleFacesEnabled() && mapViewSettings.isDoubleFaces(); + } + + /** + * Sets whether double faces on the current map should be shown. + * @param doubleFaces new value + * @see #isDoubleFaces() + */ + @ActionMethod + public void setDoubleFaces(final boolean doubleFaces) { + if (isDoubleFacesEnabled()) { + mapViewSettings.setDoubleFaces(doubleFaces); + } + } + + /** + * Action method for "tile show". + * @return <code>true</code> if adjacent tiles are shown, or + * <code>false</code> if adjacent tiles are not shown + */ + @ActionMethod + public boolean isTileShow() { + return false; + } + + /** + * Action method for "tile show". + * @param tileShow if set, show adjacent tiles + */ + @ActionMethod + public void setTileShow(final boolean tileShow) { + // not yet implemented + } + + /** + * Action method for "create view". + */ + @ActionMethod + public void mapCreateView() { + final MapView<G, A, R> mapView = getCreateViewEnabled(); + if (mapView != null) { + mapViewsManager.newMapView(mapView.getMapControl(), mapView.getMapViewBasic().getViewport().getViewPosition()); + } + } + + /** + * Action method for "map properties". + */ + @ActionMeth... [truncated message content] |
From: <aki...@us...> - 2010-05-23 10:06:26
|
Revision: 7903 http://gridarta.svn.sourceforge.net/gridarta/?rev=7903&view=rev Author: akirschbaum Date: 2010-05-23 10:06:20 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove MapCursorActions.ACTION_BUILDER. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 10:05:20 UTC (rev 7902) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 10:06:20 UTC (rev 7903) @@ -49,11 +49,6 @@ public class MapCursorActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * Action Builder to create Actions. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * Actions for "go". */ private final Action[] aGo; @@ -201,20 +196,21 @@ goLocationDialogManager = new GoLocationDialogManager<G, A, R>(mapViewManager); final String[] directionsGo = { "goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest" }; aGo = new Action[directionsGo.length]; + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); for (int i = 0; i < directionsGo.length; i++) { - aGo[i] = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, directionsGo[i]); + aGo[i] = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, directionsGo[i]); } - aGoLocation = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor", this, "goLocation"); - aSelectSquare = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "selectSquare"); - aAddToSelection = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "addToSelection"); - aSubFromSelection = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "subFromSelection"); - aStartStopDrag = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "startStopDrag"); - aReleaseDrag = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "releaseDrag"); - aInsertArch = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map", this, "insertArch"); - aDeleteArch = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map", this, "deleteArch"); - aSelectArchAbove = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Selected Square View", this, "selectArchAbove"); - aSelectArchBelow = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Selected Square View", this, "selectArchBelow"); - aArchAttributes = ActionUtils.newAction(ACTION_BUILDER, "Map", this, "archAttributes"); + aGoLocation = ActionUtils.newAction(actionBuilder, "Map Cursor", this, "goLocation"); + aSelectSquare = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, "selectSquare"); + aAddToSelection = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, "addToSelection"); + aSubFromSelection = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, "subFromSelection"); + aStartStopDrag = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, "startStopDrag"); + aReleaseDrag = ActionUtils.newAction(actionBuilder, "Map Cursor,Map/Selection", this, "releaseDrag"); + aInsertArch = ActionUtils.newAction(actionBuilder, "Map Cursor,Map", this, "insertArch"); + aDeleteArch = ActionUtils.newAction(actionBuilder, "Map Cursor,Map", this, "deleteArch"); + aSelectArchAbove = ActionUtils.newAction(actionBuilder, "Map Cursor,Selected Square View", this, "selectArchAbove"); + aSelectArchBelow = ActionUtils.newAction(actionBuilder, "Map Cursor,Selected Square View", this, "selectArchBelow"); + aArchAttributes = ActionUtils.newAction(actionBuilder, "Map", this, "archAttributes"); mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); refreshActions(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:05:26
|
Revision: 7902 http://gridarta.svn.sourceforge.net/gridarta/?rev=7902&view=rev Author: akirschbaum Date: 2010-05-23 10:05:20 +0000 (Sun, 23 May 2010) Log Message: ----------- Fix possible NullPointerException. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 10:01:35 UTC (rev 7901) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 10:05:20 UTC (rev 7902) @@ -54,9 +54,9 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * Directions for cursor movement. + * Actions for "go". */ - private final String[] directionsGo = { "goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest" }; + private final Action[] aGo; /** * Action for "go location". @@ -199,7 +199,11 @@ this.selectedSquareControl = selectedSquareControl; this.selectedSquareModel = selectedSquareModel; goLocationDialogManager = new GoLocationDialogManager<G, A, R>(mapViewManager); - ActionUtils.newActions(ACTION_BUILDER, "Map Cursor/Move Cursor", this, directionsGo); + final String[] directionsGo = { "goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest" }; + aGo = new Action[directionsGo.length]; + for (int i = 0; i < directionsGo.length; i++) { + aGo[i] = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, directionsGo[i]); + } aGoLocation = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor", this, "goLocation"); aSelectSquare = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "selectSquare"); aAddToSelection = ActionUtils.newAction(ACTION_BUILDER, "Map Cursor,Map/Selection", this, "addToSelection"); @@ -396,8 +400,8 @@ */ private void refreshActions() { final boolean goEnabled = doGo(false, CommonConstants.NORTH); - for (final String aDirectionsGo : directionsGo) { - ACTION_BUILDER.getAction(aDirectionsGo).setEnabled(goEnabled); + for (final Action action : aGo) { + action.setEnabled(goEnabled); } aGoLocation.setEnabled(doGoLocation(false)); aSelectSquare.setEnabled(doSelectSquare(false)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 10:01:41
|
Revision: 7901 http://gridarta.svn.sourceforge.net/gridarta/?rev=7901&view=rev Author: akirschbaum Date: 2010-05-23 10:01:35 +0000 (Sun, 23 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 09:32:42 UTC (rev 7900) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-23 10:01:35 UTC (rev 7901) @@ -221,10 +221,7 @@ */ @ActionMethod public void goNorth() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.NORTH); - } + doGo(true, CommonConstants.NORTH); } /** @@ -232,10 +229,7 @@ */ @ActionMethod public void goSouth() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.SOUTH); - } + doGo(true, CommonConstants.SOUTH); } /** @@ -243,10 +237,7 @@ */ @ActionMethod public void goEast() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.EAST); - } + doGo(true, CommonConstants.EAST); } /** @@ -254,10 +245,7 @@ */ @ActionMethod public void goWest() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.WEST); - } + doGo(true, CommonConstants.WEST); } /** @@ -265,10 +253,7 @@ */ @ActionMethod public void goNorthEast() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.NORTH_EAST); - } + doGo(true, CommonConstants.NORTH_EAST); } /** @@ -276,10 +261,7 @@ */ @ActionMethod public void goNorthWest() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.NORTH_WEST); - } + doGo(true, CommonConstants.NORTH_WEST); } /** @@ -287,10 +269,7 @@ */ @ActionMethod public void goSouthEast() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.SOUTH_EAST); - } + doGo(true, CommonConstants.SOUTH_EAST); } /** @@ -298,10 +277,7 @@ */ @ActionMethod public void goSouthWest() { - final MapCursor mapCursor = getGoEnabled(); - if (mapCursor != null) { - mapCursor.goTo(CommonConstants.SOUTH_WEST); - } + doGo(true, CommonConstants.SOUTH_WEST); } /** @@ -309,10 +285,7 @@ */ @ActionMethod public void goLocation() { - final MapView<G, A, R> mapView = getGoLocationEnabled(); - if (mapView != null) { - goLocationDialogManager.showDialog(mapView); - } + doGoLocation(true); } /** @@ -320,10 +293,7 @@ */ @ActionMethod public void selectSquare() { - final MapCursor mapCursor = getSelectSquareEnabled(); - if (mapCursor != null) { - selectSquare(mapCursor, SelectionMode.FLIP); - } + doSelectSquare(true); } /** @@ -331,10 +301,7 @@ */ @ActionMethod public void addToSelection() { - final MapCursor mapCursor = getAddToSelectionEnabled(); - if (mapCursor != null) { - selectSquare(mapCursor, SelectionMode.ADD); - } + doAddToSelection(true); } /** @@ -342,10 +309,7 @@ */ @ActionMethod public void subFromSelection() { - final MapCursor mapCursor = getSubFromSelectionEnabled(); - if (mapCursor != null) { - selectSquare(mapCursor, SelectionMode.SUB); - } + doSubFromSelection(true); } /** @@ -353,10 +317,7 @@ */ @ActionMethod public void startStopDrag() { - final MapCursor mapCursor = getStartStopDragEnabled(); - if (mapCursor != null) { - startStopDrag(mapCursor); - } + doStartStopDrag(true); } /** @@ -364,10 +325,7 @@ */ @ActionMethod public void releaseDrag() { - final MapCursor mapCursor = getReleaseDragEnabled(); - if (mapCursor != null) { - releaseDrag(mapCursor); - } + doReleaseDrag(true); } /** @@ -375,10 +333,7 @@ */ @ActionMethod public void insertArch() { - final MapView<G, A, R> mapView = getInsertArchEnabled(); - if (mapView != null) { - selectedSquareControl.insertGameObjectFromObjectChooser(mapView); - } + doInsertArch(true); } /** @@ -386,10 +341,7 @@ */ @ActionMethod public void deleteArch() { - final MapView<G, A, R> mapView = getDeleteArchEnabled(); - if (mapView != null) { - selectedSquareControl.deleteSelection(mapView); - } + doDeleteArch(true); } /** @@ -397,10 +349,7 @@ */ @ActionMethod public void selectArchAbove() { - final MapCursor mapCursor = getSelectArchAboveEnabled(); - if (mapCursor != null) { - selectedSquareControl.selectArch(true); - } + doSelectArchAbove(true); } /** @@ -408,10 +357,7 @@ */ @ActionMethod public void selectArchBelow() { - final MapCursor mapCursor = getSelectArchBelowEnabled(); - if (mapCursor != null) { - selectedSquareControl.selectArch(false); - } + doSelectArchBelow(true); } /** @@ -419,192 +365,295 @@ */ @ActionMethod public void archAttributes() { - final G gameObject = getArchAttributesEnabled(); - if (gameObject != null) { - gameObjectAttributesDialogFactory.showAttribDialog(gameObject); - } + doArchAttributes(true); } /** - * Return the map cursor to use for "move cursor". - * @return the map cursor, or <code>null</code> if "move cursor" is - * disabled + * Return the map cursor of the current map view if it is active. + * @return the map cursor, or <code>null</code> if the cursor is not active, + * or if no map view exists */ @Nullable - private MapCursor getGoEnabled() { - return getActiveMapCursor(); + private MapCursor getActiveMapCursor() { + final MapView<G, A, R> mapView = currentMapView; + return mapView == null ? null : getActiveMapCursor(mapView); } /** - * Return the map view to use for "go location". - * @return the map view, or <code>null</code> if "go location" is disabled + * Return the map cursor of a map view if it is active. + * @param mapView the map view + * @return the map cursor, or <code>null</code> if the cursor is not active, + * or if no map view exists */ @Nullable - private MapView<G, A, R> getGoLocationEnabled() { - return currentMapView; + private MapCursor getActiveMapCursor(@NotNull final MapView<G, A, R> mapView) { + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + return mapCursor.isActive() ? mapCursor : null; } /** - * Return the map cursor to use for "select square". - * @return the map cursor, or <code>null</code> if "select square" is - * disabled + * Enable/disable menu entries based on the current cursor state. */ - @Nullable - private MapCursor getSelectSquareEnabled() { - return getActiveMapCursor(); + private void refreshActions() { + final boolean goEnabled = doGo(false, CommonConstants.NORTH); + for (final String aDirectionsGo : directionsGo) { + ACTION_BUILDER.getAction(aDirectionsGo).setEnabled(goEnabled); + } + aGoLocation.setEnabled(doGoLocation(false)); + aSelectSquare.setEnabled(doSelectSquare(false)); + aAddToSelection.setEnabled(doAddToSelection(false)); + aSubFromSelection.setEnabled(doSubFromSelection(false)); + aStartStopDrag.setEnabled(doStartStopDrag(false)); + aReleaseDrag.setEnabled(doReleaseDrag(false)); + aInsertArch.setEnabled(doInsertArch(false)); + aDeleteArch.setEnabled(doDeleteArch(false)); + aSelectArchAbove.setEnabled(doSelectArchAbove(false)); + aSelectArchBelow.setEnabled(doSelectArchBelow(false)); + aArchAttributes.setEnabled(doArchAttributes(false)); } + private static void selectSquare(@NotNull final MapCursor mapCursor, final SelectionMode mode) { + mapCursor.dragStart(); + mapCursor.dragSelect(mode); + } + /** - * Return the map cursor to use for "add to selection". - * @return the map cursor, or <code>null</code> if "add to selection" is - * disabled + * Executes the "go" action. + * @param performAction whether the action should be performed + * @param direction the direction to go + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getAddToSelectionEnabled() { - return getActiveMapCursor(); + private boolean doGo(final boolean performAction, final int direction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + mapCursor.goTo(direction); + } + + return true; } /** - * Return the map cursor to use for "remove from selection". - * @return the map cursor, or <code>null</code> if "remove from selection" - * is disabled + * Executes the "go location" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getSubFromSelectionEnabled() { - return getActiveMapCursor(); + private boolean doGoLocation(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + goLocationDialogManager.showDialog(mapView); + } + + return true; } /** - * Return the map cursor to use for "start stop drag". - * @return the map cursor, or <code>null</code> if "start stop drag" is - * disabled + * Executes the "select square" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getStartStopDragEnabled() { - return getActiveMapCursor(); + private boolean doSelectSquare(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + selectSquare(mapCursor, SelectionMode.FLIP); + } + + return true; } /** - * Return the map cursor to use for "release drag". - * @return the map cursor, or <code>null</code> if "release drag" is - * disabled + * Executes the "add to selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getReleaseDragEnabled() { - return getActiveMapCursor(); + private boolean doAddToSelection(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + selectSquare(mapCursor, SelectionMode.ADD); + } + + return true; } /** - * Return the map to use for "insert arch". - * @return the map, or <code>null</code> if "insert arch" is disabled + * Executes the "sub from selection" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getInsertArchEnabled() { - return getActiveMapCursor() != null ? currentMapView : null; + private boolean doSubFromSelection(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false;} + + if (performAction) { + selectSquare(mapCursor, SelectionMode.SUB); + } + + return true; } /** - * Return the map to use for "delete arch". - * @return the map, or <code>null</code> if "delete arch" is disabled + * Executes the "start stop drag" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapView<G, A, R> getDeleteArchEnabled() { - return getActiveMapCursor() != null ? currentMapView : null; + private boolean doStartStopDrag(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + if (mapCursor.isDragging()) { + mapCursor.dragSelect(SelectionMode.FLIP); + } else { + mapCursor.dragStart(); + } + } + + return true; } /** - * Return the map cursor to use for "select arch above". - * @return the map cursor, or <code>null</code> if "select arch above" is - * disabled + * Executes the "release drag" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getSelectArchAboveEnabled() { - return getActiveMapCursor(); + private boolean doReleaseDrag(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + if (mapCursor.isDragging()) { + mapCursor.dragRelease(); + } else { + final Point location = mapCursor.getLocation(); + mapCursor.deactivate(); + mapCursor.setLocation(location); + } + } + + return true; } /** - * Return the map cursor to use for "select arch below". - * @return the map cursor, or <code>null</code> if "select arch below" is - * disabled + * Executes the "insert arch" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getSelectArchBelowEnabled() { - return getActiveMapCursor(); + private boolean doInsertArch(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (getActiveMapCursor(mapView) == null) { // XXX: should pass to function + return false; + } + + if (performAction) { + selectedSquareControl.insertGameObjectFromObjectChooser(mapView); + } + + return true; } /** - * Return the game object to use for "arch attributes". - * @return the game object, or <code>null</code> if "arch attributes" is - * disabled + * Executes the "delete arch" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private G getArchAttributesEnabled() { - final MapCursor mapCursor = getActiveMapCursor(); - return mapCursor != null ? selectedSquareModel.getSelectedGameObject() : null; + private boolean doDeleteArch(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (getActiveMapCursor(mapView) == null) { // XXX: should pass to function + return false; + } + + if (performAction) { + selectedSquareControl.deleteSelection(mapView); + } + + return true; } /** - * Return the map cursor of the current map view if it is active. - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists + * Executes the "select arch above" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getActiveMapCursor() { - final MapCursor mapCursor = getMapCursor(); - return mapCursor != null && mapCursor.isActive() ? mapCursor : null; + private boolean doSelectArchAbove(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + selectedSquareControl.selectArch(true); + } + + return true; } /** - * Return the map cursor of the current map view. - * @return the map cursor, or <code>null</code> if no map view exists + * Executes the "select arch below" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @Nullable - private MapCursor getMapCursor() { - return currentMapView != null ? currentMapView.getMapViewBasic().getMapCursor() : null; + private boolean doSelectArchBelow(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + selectedSquareControl.selectArch(false); + } + + return true; } /** - * Enable/disable menu entries based on the current cursor state. + * Executes the "arch attributes" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - private void refreshActions() { - final boolean goEnabled = getGoEnabled() != null; - for (final String aDirectionsGo : directionsGo) { - ACTION_BUILDER.getAction(aDirectionsGo).setEnabled(goEnabled); + private boolean doArchAttributes(final boolean performAction) { + final MapCursor mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; } - aGoLocation.setEnabled(getGoLocationEnabled() != null); - aSelectSquare.setEnabled(getSelectSquareEnabled() != null); - aAddToSelection.setEnabled(getAddToSelectionEnabled() != null); - aSubFromSelection.setEnabled(getSubFromSelectionEnabled() != null); - aStartStopDrag.setEnabled(getStartStopDragEnabled() != null); - aReleaseDrag.setEnabled(getReleaseDragEnabled() != null); - aInsertArch.setEnabled(getInsertArchEnabled() != null); - aDeleteArch.setEnabled(getDeleteArchEnabled() != null); - aSelectArchAbove.setEnabled(getSelectArchAboveEnabled() != null); - aSelectArchBelow.setEnabled(getSelectArchBelowEnabled() != null); - aArchAttributes.setEnabled(getArchAttributesEnabled() != null); - } - private static void selectSquare(@NotNull final MapCursor mapCursor, final SelectionMode mode) { - mapCursor.dragStart(); - mapCursor.dragSelect(mode); - } + final G gameObject = selectedSquareModel.getSelectedGameObject(); + if (gameObject == null) { + return false; + } - private static void startStopDrag(@NotNull final MapCursor mapCursor) { - if (mapCursor.isDragging()) { - mapCursor.dragSelect(SelectionMode.FLIP); - } else { - mapCursor.dragStart(); + if (performAction) { + gameObjectAttributesDialogFactory.showAttribDialog(gameObject); } - } - private static void releaseDrag(@NotNull final MapCursor mapCursor) { - if (mapCursor.isDragging()) { - mapCursor.dragRelease(); - } else { - final Point p = mapCursor.getLocation(); - mapCursor.deactivate(); - mapCursor.setLocation(p); - } + return true; } } // class MapCursorActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 09:32:48
|
Revision: 7900 http://gridarta.svn.sourceforge.net/gridarta/?rev=7900&view=rev Author: akirschbaum Date: 2010-05-23 09:32:42 +0000 (Sun, 23 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-23 09:29:12 UTC (rev 7899) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-23 09:32:42 UTC (rev 7900) @@ -284,130 +284,162 @@ * Update the enabled/disabled state of all actions. */ private void updateActions() { - aSaveMap.setEnabled(getSaveMapEnabled() != null); - //noinspection CallToSimpleGetterFromWithinClass - aSaveMapAs.setEnabled(getSaveAsEnabled() != null); - aCreateImage.setEnabled(getCreateImageEnabled() != null); - aRevertMap.setEnabled(getRevertMapEnabled() != null); - //noinspection CallToSimpleGetterFromWithinClass - aCloseMap.setEnabled(getCloseMapEnabled() != null); + aSaveMap.setEnabled(doSaveMap(false)); + aSaveMapAs.setEnabled(doSaveMapAs(false)); + aCreateImage.setEnabled(doCreateImage(false)); + aRevertMap.setEnabled(doRevertMap(false)); + aCloseMap.setEnabled(doCloseMap(false)); } /** - * Determine whether "save map" is enabled. - * @return the map control for which "save map" is enabled, or - * <code>null</code> if "save map" is disabled + * Invoked when the user wants to save the map. */ - @Nullable - private MapControl<G, A, R> getSaveMapEnabled() { - final MapControl<G, A, R> mapControl = currentMapControl; - return mapControl != null && mapControl.getMapModel().isModified() ? mapControl : null; + @ActionMethod + public void saveMap() { + doSaveMap(true); } /** - * Determine whether "save as" is enabled. - * @return the map control for which "save as" is enabled, or - * <code>null</code> if "save as" is disabled + * Invoked when the user wants to save the map to a file. */ - @Nullable - private MapControl<G, A, R> getSaveAsEnabled() { - return currentMapControl; + @ActionMethod + public void saveMapAs() { + doSaveMapAs(true); } /** - * Determine whether "create image" is enabled. - * @return the map view for which "create image" is enabled, or - * <code>null</code> if "create image" is disabled + * Invoked when the user wants to create an image file of the map. */ - @Nullable - private MapModel<G, A, R> getCreateImageEnabled() { - final MapView<G, A, R> mapView = currentMapView; - return mapView == null ? null : mapView.getMapControl().getMapModel(); + @ActionMethod + public void createImage() { + doCreateImage(true); } /** - * Determine whether "revert map" is enabled. - * @return the map control for which "revert map" is enabled, or - * <code>null</code> if "revert map" is disabled + * Invoked when the user wants to revert the map to the previously saved + * state. */ - @Nullable - private MapControl<G, A, R> getRevertMapEnabled() { - final MapControl<G, A, R> mapControl = currentMapControl; - return mapControl != null && mapControl.getMapModel().getMapFile() != null && mapControl.getMapModel().isModified() ? mapControl : null; + @ActionMethod + public void revertMap() { + doRevertMap(true); } /** - * Determine whether "close map" is enabled. - * @return the map view for which "close map" is enabled, or - * <code>null</code> if "close map" is disabled + * Invoked when the user wants to close the map. */ - @Nullable - private MapView<G, A, R> getCloseMapEnabled() { - return currentMapView; + @ActionMethod + public void closeMap() { + doCloseMap(true); } /** - * Invoked when the user wants to save the map. + * Executes the "save map" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void saveMap() { - final MapControl<G, A, R> mapControl = getSaveMapEnabled(); - if (mapControl != null) { - fileControl.save(mapControl); + private boolean doSaveMap(final boolean performAction) { + final MapControl<G, A, R> mapControl = currentMapControl; + if (mapControl == null || !mapControl.getMapModel().isModified()) { + return false; } + + if (performAction) { + if (!fileControl.save(mapControl)) { + return false; + } + } + + return true; } /** - * Invoked when the user wants to save the map to a file. + * Executes the "save map as" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void saveMapAs() { - //noinspection CallToSimpleGetterFromWithinClass - final MapControl<G, A, R> mapControl = getSaveAsEnabled(); - if (mapControl != null) { - fileControl.saveAs(mapControl); + private boolean doSaveMapAs(final boolean performAction) { + final MapControl<G, A, R> mapControl = currentMapControl; + if (mapControl == null) { + return false; } + + if (performAction) { + if (!fileControl.saveAs(mapControl)) { + return false; + } + } + + return true; } /** - * Invoked when the user wants to create an image file of the map. + * Executes the "create image" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void createImage() { - final MapModel<G, A, R> mapModel = getCreateImageEnabled(); - if (mapModel != null) { + private boolean doCreateImage(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); imageCreator2.createImage(mapModel, mainView); } + + return true; } /** - * Invoked when the user wants to revert the map to the previously saved - * state. + * Executes the "revert map" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void revertMap() { - final MapControl<G, A, R> mapControl = getRevertMapEnabled(); + private boolean doRevertMap(final boolean performAction) { + final MapControl<G, A, R> mapControl = currentMapControl; if (mapControl == null) { - return; + return false; } - try { - mapManager.revert(mapControl); - } catch (final IOException ex) { - fileControl.reportLoadError(mapControl.getMapModel().getMapFile(), ex.getMessage()); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + if (!mapModel.isModified()) { + return false; } + + final File mapFile = mapModel.getMapFile(); + if (mapFile == null) { + return false; + } + + if (performAction) { + try { + mapManager.revert(mapControl); + } catch (final IOException ex) { + fileControl.reportLoadError(mapFile, ex.getMessage()); + return false; + } + } + + return true; } /** - * Invoked when the user wants to close the map. + * Executes the "close map" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed */ - @ActionMethod - public void closeMap() { - //noinspection CallToSimpleGetterFromWithinClass - final MapView<G, A, R> mapView = getCloseMapEnabled(); - if (mapView != null) { + private boolean doCloseMap(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { mapViewsManager.closeMapView(mapView); } + + return true; } } // class MapFileActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 09:29:18
|
Revision: 7899 http://gridarta.svn.sourceforge.net/gridarta/?rev=7899&view=rev Author: akirschbaum Date: 2010-05-23 09:29:12 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove MapControl.mapClosed(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 09:26:59 UTC (rev 7898) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 09:29:12 UTC (rev 7899) @@ -172,7 +172,7 @@ for (final MapManagerListener<G, A, R> listener : listenerList.getListeners()) { listener.mapClosed(mapControl); } - mapControl.mapClosed(); + mapControl.getMapModel().mapClosed(); } /** Modified: trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java 2010-05-23 09:26:59 UTC (rev 7898) +++ trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java 2010-05-23 09:29:12 UTC (rev 7899) @@ -94,14 +94,6 @@ * {@inheritDoc} */ @Override - public void mapClosed() { - mapModel.mapClosed(); - } - - /** - * {@inheritDoc} - */ - @Override public void addMapControlListener(@NotNull final MapControlListener<G, A, R> listener) { listenerList.add(listener); } Modified: trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java 2010-05-23 09:26:59 UTC (rev 7898) +++ trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java 2010-05-23 09:29:12 UTC (rev 7899) @@ -66,11 +66,6 @@ void save() throws IOException; /** - * This function must be called if this instance is freed. - */ - void mapClosed(); - - /** * Saves the file with the given file name. * @param file the file to be saved to * @throws IOException if saving fails This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 09:27:06
|
Revision: 7898 http://gridarta.svn.sourceforge.net/gridarta/?rev=7898&view=rev Author: akirschbaum Date: 2010-05-23 09:26:59 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove MapControl.getPlainSaveFile(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-23 09:08:24 UTC (rev 7897) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-23 09:26:59 UTC (rev 7898) @@ -333,7 +333,7 @@ @Nullable private MapControl<G, A, R> getRevertMapEnabled() { final MapControl<G, A, R> mapControl = currentMapControl; - return mapControl != null && mapControl.getPlainSaveFile() != null && mapControl.getMapModel().isModified() ? mapControl : null; + return mapControl != null && mapControl.getMapModel().getMapFile() != null && mapControl.getMapModel().isModified() ? mapControl : null; } /** Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-23 09:08:24 UTC (rev 7897) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-23 09:26:59 UTC (rev 7898) @@ -243,7 +243,7 @@ */ @Override public boolean save(@NotNull final MapControl<G, A, R> mapControl) { - final File file = mapControl.getPlainSaveFile(); + final File file = mapControl.getMapModel().getMapFile(); if (file != null) { try { mapControl.save(); Modified: trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java 2010-05-23 09:08:24 UTC (rev 7897) +++ trunk/src/app/net/sf/gridarta/model/map/mapcontrol/DefaultMapControl.java 2010-05-23 09:26:59 UTC (rev 7898) @@ -34,7 +34,6 @@ import net.sf.gridarta.utils.EventListenerList2; import net.sf.gridarta.utils.IOUtils; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Implements map models. @@ -143,16 +142,7 @@ /** * {@inheritDoc} */ - @Nullable @Override - public File getPlainSaveFile() { - return mapModel.getMapFile(); - } - - /** - * {@inheritDoc} - */ - @Override public boolean isPickmap() { return isPickmap; } Modified: trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java 2010-05-23 09:08:24 UTC (rev 7897) +++ trunk/src/app/net/sf/gridarta/model/map/mapcontrol/MapControl.java 2010-05-23 09:26:59 UTC (rev 7898) @@ -26,7 +26,6 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Currently nothing more than a marker interface for unification. @@ -94,12 +93,4 @@ */ int getUseCounter(); - /** - * Return whether the map can be just saved (true) or does it need to be - * saved as (false). - * @return the file if the map can be just saved, <code>null</code> if not - */ - @Nullable - File getPlainSaveFile(); - } // interface MapControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 09:08:32
|
Revision: 7897 http://gridarta.svn.sourceforge.net/gridarta/?rev=7897&view=rev Author: akirschbaum Date: 2010-05-23 09:08:24 +0000 (Sun, 23 May 2010) Log Message: ----------- Reformat .html and .xml files. Modified Paths: -------------- trunk/atrinik/resource/HelpFiles/credits.html trunk/atrinik/resource/HelpFiles/faq.html trunk/atrinik/resource/HelpFiles/guide.html trunk/atrinik/resource/HelpFiles/pycredits.html trunk/atrinik/resource/HelpFiles/pyfaq.html trunk/atrinik/resource/HelpFiles/pyguide.html trunk/atrinik/resource/HelpFiles/pystart.html trunk/atrinik/resource/HelpFiles/start.html trunk/atrinik/resource/HelpFiles/treasure_multi.html trunk/atrinik/resource/HelpFiles/treasure_one.html trunk/atrinik/resource/HelpFiles/treasure_special.html trunk/atrinik/resource/HelpFiles/treasurelists.html trunk/atrinik/resource/HelpFiles/tut_DScript.html trunk/atrinik/resource/HelpFiles/tut_copypaste.html trunk/atrinik/resource/HelpFiles/tut_frames.html trunk/atrinik/resource/HelpFiles/tut_intro.html trunk/atrinik/resource/HelpFiles/tut_loading.html trunk/atrinik/resource/HelpFiles/tut_map.html trunk/atrinik/resource/HelpFiles/tut_mapattr.html trunk/atrinik/resource/HelpFiles/tut_objects.html trunk/atrinik/resource/HelpFiles/tut_scriptev.html trunk/atrinik/resource/HelpFiles/tut_view.html trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/overview.html trunk/crossfire/resource/HelpFiles/credits.html trunk/crossfire/resource/HelpFiles/faq.html trunk/crossfire/resource/HelpFiles/guide.html trunk/crossfire/resource/HelpFiles/map_basic.html trunk/crossfire/resource/HelpFiles/map_otcs.html trunk/crossfire/resource/HelpFiles/map_quests.html trunk/crossfire/resource/HelpFiles/map_start.html trunk/crossfire/resource/HelpFiles/start.html trunk/crossfire/resource/HelpFiles/treasure_multi.html trunk/crossfire/resource/HelpFiles/treasure_one.html trunk/crossfire/resource/HelpFiles/treasure_special.html trunk/crossfire/resource/HelpFiles/treasurelists.html trunk/crossfire/resource/HelpFiles/tut_copypaste.html trunk/crossfire/resource/HelpFiles/tut_frames.html trunk/crossfire/resource/HelpFiles/tut_loading.html trunk/crossfire/resource/HelpFiles/tut_map.html trunk/crossfire/resource/HelpFiles/tut_mapattr.html trunk/crossfire/resource/HelpFiles/tut_objects.html trunk/crossfire/resource/HelpFiles/tut_pickmaps.html trunk/crossfire/resource/HelpFiles/tut_view.html trunk/crossfire.iml trunk/daimonin/resource/HelpFiles/credits.html trunk/daimonin/resource/HelpFiles/faq.html trunk/daimonin/resource/HelpFiles/guide.html trunk/daimonin/resource/HelpFiles/pycredits.html trunk/daimonin/resource/HelpFiles/pyfaq.html trunk/daimonin/resource/HelpFiles/pyguide.html trunk/daimonin/resource/HelpFiles/pystart.html trunk/daimonin/resource/HelpFiles/start.html trunk/daimonin/resource/HelpFiles/treasure_multi.html trunk/daimonin/resource/HelpFiles/treasure_one.html trunk/daimonin/resource/HelpFiles/treasure_special.html trunk/daimonin/resource/HelpFiles/treasurelists.html trunk/daimonin/resource/HelpFiles/tut_DScript.html trunk/daimonin/resource/HelpFiles/tut_copypaste.html trunk/daimonin/resource/HelpFiles/tut_frames.html trunk/daimonin/resource/HelpFiles/tut_intro.html trunk/daimonin/resource/HelpFiles/tut_loading.html trunk/daimonin/resource/HelpFiles/tut_map.html trunk/daimonin/resource/HelpFiles/tut_mapattr.html trunk/daimonin/resource/HelpFiles/tut_objects.html trunk/daimonin/resource/HelpFiles/tut_scriptev.html trunk/daimonin/resource/HelpFiles/tut_view.html trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/overview.html trunk/gridarta.ipr Modified: trunk/atrinik/resource/HelpFiles/credits.html =================================================================== --- trunk/atrinik/resource/HelpFiles/credits.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/credits.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,22 +19,22 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Credits</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Credits</TITLE> </HEAD> <BODY> -<P><A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>Daimonin Java Editor Credits</H1> <P>The Daimonin Java Editor team:</P> <UL> - <LI>Michael Toennies - <LI>Andreas Vogl + <LI>Michael Toennies + <LI>Andreas Vogl </UL> - </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/faq.html =================================================================== --- trunk/atrinik/resource/HelpFiles/faq.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/faq.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,69 +19,71 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Help FAQ</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Help FAQ</TITLE> </HEAD> <BODY> -<P><A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>Daimonin Java Editor FAQ</H1> <P><B>The map is displayed in a weird wrong shape. Is this a bug?</B></P> -<P> No certainly not. Under the menu "Map->Map Properties", you have to adjust the -setting of the checkbox "Show Isometric". It must be disabled for rectangular -arches, and enabled for iso arches. You should also adjust the global iso -setting under "File->Options..." accordingly. -</P> +<P> No certainly not. Under the menu "Map->Map Properties", you have to adjust + the setting of the checkbox "Show Isometric". It must be disabled for + rectangular arches, and enabled for iso arches. You should also adjust the + global iso setting under "File->Options..." accordingly.</P> + <P><B>Where can I get the latest version of the JavaEditor?</B></P> + <P>The best source is <http://mids.student.utwente.nl/~avogl/CFJavaEditor>. -This is my personal page and I usually care about it. You'll find notes about -recent updates and the changes being made. Anyways, please keep in mind that -I'm only a student. I don't always have time, nor do I own that domain. -So it certainly could happen that it is down sometimes or not perfectly up-to-date. -</P> -<P>Another good (and the most reliable) source is Daimonin's CVS repository. Go to -<http://sourceforge.net/projects/daimonin/> and try to figure out -how to do an anonymous checkout. The package is called "CFJavaEditor". -</P> + This is my personal page and I usually care about it. You'll find notes + about recent updates and the changes being made. Anyways, please keep in + mind that I'm only a student. I don't always have time, nor do I own that + domain. So it certainly could happen that it is down sometimes or not + perfectly up-to-date.</P> + +<P>Another good (and the most reliable) source is Daimonin's CVS repository. Go + to <http://sourceforge.net/projects/daimonin/> and try to figure out + how to do an anonymous checkout. The package is called "CFJavaEditor".</P> + <P> -The third possibility is you get an official release version. For that you -can either look on Sourceforge or <http://daimonin.real-time.com>. -</P> + The third possibility is you get an official release version. For that you + can either look on Sourceforge or <http://daimonin.real-time.com>.</P> <P><B>The editor has successfully loaded the arches, but all the images are -missing. WTF?</B></P> + missing. WTF?</B></P> <UL> -<LI><P>If you are using up-to-date Daimonin arches, these support -multiple image sets. Select menu "File->Options" and make sure -the entry "Use Image Set" is set to "Base". -If you are using old arches, or iso arches, make sure the entry -"Use Image Set" is set to "Disabled". -If your settings were wrong then restart the editor after correction. -</P> -<LI><P>Another possibility is that you have compiled the editor in a weird -wrong way, missing to include the files of the sixlegs png library "png.jar". -</P> + <LI><P>If you are using up-to-date Daimonin arches, these support multiple + image sets. Select menu "File->Options" and make sure the entry "Use + Image Set" is set to "Base". If you are using old arches, or iso arches, + make sure the entry "Use Image Set" is set to "Disabled". If your + settings were wrong then restart the editor after correction.</P> + <LI><P>Another possibility is that you have compiled the editor in a weird + wrong way, missing to include the files of the sixlegs png library + "png.jar".</P> </UL> -<P><B>Whenever I start the JavaEditor, I get a bunch of errormessages -concerning some missing font. What does that mean?</B></P> -<P>That appears to happen with several Linux distributions. -The messages might be annoying, but it's completely harmless. -Simply ignore it. If using Java SDK version 1.3, upgrading to 1.4 might -resolve the problem and maybe even get you a better-looking default font. +<P><B>Whenever I start the JavaEditor, I get a bunch of errormessages concerning + some missing font. What does that mean?</B></P> + +<P>That appears to happen with several Linux distributions. The messages might + be annoying, but it's completely harmless. Simply ignore it. If using Java + SDK version 1.3, upgrading to 1.4 might resolve the problem and maybe even + get you a better-looking default font.</P> + +<P><B>My CPU is too slow for this program, and my memory doesn't suffice... and + my display has only 256 colors. What can I do?</B></P> + +<P>Let's see... Buy a new computer? :-) + <br> + Now seriously, I'm sorry that this program requires a certain level of + system performance - But I can't help it. I have invested big amounts of + time to make everything run as fast as possible and with least Memory + consumption. </P> -<P><B>My CPU is too slow for this program, and my memory doesn't suffice... -and my display has only 256 colors. What can I do?</B></P> -<P>Let's see... Buy a new computer? :-)<br> -Now seriously, I'm sorry that this program requires a certain level of -system performance - But I can't help it. I have invested big amounts of -time to make everything run as fast as possible and with least -Memory consumption. -<br> -</P> </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/guide.html =================================================================== --- trunk/atrinik/resource/HelpFiles/guide.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/guide.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,68 +19,78 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Guidelines for Map-making</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Guidelines for Map-making</TITLE> </HEAD> <BODY> -<P><A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>General Guidelines for Map-making</H1> -<H2 align=center><IMG SRC="landscape.jpg" WIDTH="176" HEIGHT="132" ALIGN="MIDDLE" NATURALSIZEFLAG="3"></H2> + +<H2 align=center> + <IMG SRC="landscape.jpg" WIDTH="176" HEIGHT="132" ALIGN="MIDDLE" NATURALSIZEFLAG="3"> +</H2> <table border=2> -Of course you have total creative freedom at building your maps. But if you'd -like to have your maps included in the official Daimonin distribution, you -should keep the following "golden rules" in your mind. Actually it's more -guidelines than rules. However, if you've played Daimonin for a while, I bet -you'll find them quite reasonable anyways. + Of course you have total creative freedom at building your maps. But if + you'd like to have your maps included in the official Daimonin distribution, + you should keep the following "golden rules" in your mind. Actually it's + more guidelines than rules. However, if you've played Daimonin for a while, + I bet you'll find them quite reasonable anyways. </table> <H2 align=center>Guidelines for map-layout and -concept:</H2> <UL> - <LI>Pure hack'n'slash maps are boring. <B>Your maps should contain a - storyline</B>, or at least a "theme". Put NPCs (non-player-characters), - books and magic_mouths into your maps to present your stories. - <LI><B>Places with high level monsters should not be easy to reach.</B> I know there - are several maps breaking with this rule, but that doesn't mean it's okay. - If you intend to use monsters like Jessies/Demonlords/Ancient Dragons, put - them at the end of a quest, not at the beginning. - <LI><B>Put secrets into your maps.</B> Places that can only be reached after - investigating libraries, talking to NPCs and the likes. Make your maps non-linear. - It is nice to have more than one way to solve a quest. Maybe one obvious way with - brute fighting, and one clever way that needs more questing. - <LI><B>Make sure that everything works as you intended</B>, especially check all - your exit paths. Avoid one-way paths, trapping the player. And keep in mind - - Maps do reset! Example: When a player disconnects behind an opened (formerly - locked) door, he will be trapped when he rejoins the game later. Eventually place - "emergency exits" for such cases. - <LI><B>Motivate the player to use</B> as <B>many skills</B> as possible to solve - your quests. Make him fight, think, disarm traps, cast spells, fly over pits, ... - possibilities are great - make use of them. - <LI><B>Treat the player in a fair way.</B> If you surprise him with instant death, - he will hate your maps. A player should be aware of dangers, so that he has at - least the *possibility* to react. Besides, don't plunge players into frustration. - When you create puzzles, try to keep them at a level where they are solvable by - mortal beings.<br> - (That doesn't mean all puzzles have to be short and small, just "solvable".) - Players could look at your maps via editor at any time. Don't force them doing - this. Support the "honorable" players. - <LI>If you plan to create a big mapset, <B>include maps of all difficulty levels.</B> - It's absolutely okay and reasonable to have areas where a certain difficulty - level dominates. Just try not to overdo it. + <LI>Pure hack'n'slash maps are boring. <B>Your maps should contain a + storyline</B>, or at least a "theme". Put NPCs (non-player-characters), + books and magic_mouths into your maps to present your stories. + <LI><B>Places with high level monsters should not be easy to reach.</B> I + know there are several maps breaking with this rule, but that doesn't + mean it's okay. If you intend to use monsters like + Jessies/Demonlords/Ancient Dragons, put them at the end of a quest, not + at the beginning. + <LI><B>Put secrets into your maps.</B> Places that can only be reached after + investigating libraries, talking to NPCs and the likes. Make your maps + non-linear. It is nice to have more than one way to solve a quest. Maybe + one obvious way with brute fighting, and one clever way that needs more + questing. + <LI><B>Make sure that everything works as you intended</B>, especially check + all your exit paths. Avoid one-way paths, trapping the player. And keep + in mind - Maps do reset! Example: When a player disconnects behind an + opened (formerly locked) door, he will be trapped when he rejoins the + game later. Eventually place "emergency exits" for such cases. + <LI><B>Motivate the player to use</B> as <B>many skills</B> as possible to + solve your quests. Make him fight, think, disarm traps, cast spells, fly + over pits, ... possibilities are great - make use of them. + <LI><B>Treat the player in a fair way.</B> If you surprise him with instant + death, he will hate your maps. A player should be aware of dangers, so + that he has at least the *possibility* to react. Besides, don't plunge + players into frustration. When you create puzzles, try to keep them at a + level where they are solvable by mortal beings. + <br> + (That doesn't mean all puzzles have to be short and small, just + "solvable".) Players could look at your maps via editor at any time. + Don't force them doing this. Support the "honorable" players. + <LI>If you plan to create a big mapset, <B>include maps of all difficulty + levels.</B> It's absolutely okay and reasonable to have areas where a + certain difficulty level dominates. Just try not to overdo it. </UL> <H2 align=center>Guidlines for creating Artifacts:</H2> <UL> - <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> - <LI>When you create a new artifact (weapon, armor, etc), <B>always keep an eye - on playbalance.</B> Powerful items must NOT be reachable without hard fighting - AND questing. Look at other maps. Try to adopt the average taste of "difficulty". - Make sure the artifact is always hard to get, not only for the first time. - A hidden location, for instance, does not suffice. - <LI><B>Every good artifact should have negative attributes as well.</B> - There should be no "perfect set of equipment". - <LI><B>Don't ruin existing quests</B> by inserting identical (or even better) - items at easier places. There is enough room for new kinds of artifacts/treasure. + <LI><B>Don't rely on artifacts to make your maps interesting for + players.</B> + <LI>When you create a new artifact (weapon, armor, etc), <B>always keep an + eye on playbalance.</B> Powerful items must NOT be reachable without + hard fighting AND questing. Look at other maps. Try to adopt the average + taste of "difficulty". Make sure the artifact is always hard to get, not + only for the first time. A hidden location, for instance, does not + suffice. + <LI><B>Every good artifact should have negative attributes as well.</B> + There should be no "perfect set of equipment". + <LI><B>Don't ruin existing quests</B> by inserting identical (or even + better) items at easier places. There is enough room for new kinds of + artifacts/treasure. </UL> </BODY> Modified: trunk/atrinik/resource/HelpFiles/pycredits.html =================================================================== --- trunk/atrinik/resource/HelpFiles/pycredits.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/pycredits.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,23 +19,24 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Credits</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Credits</TITLE> </HEAD> <BODY> -<P><A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> + <H1 align=center>Daimonin Java Script Editor Credits</H1> <P>The Daimonin Java Script Editor team:</P> <UL> - <LI>Michael Toennies - <LI>Andreas Vogl - <LI>Peter Plischewsky (Rustyblade) - <LI>Björn Axelsson (Gecko) + <LI>Michael Toennies + <LI>Andreas Vogl + <LI>Peter Plischewsky (Rustyblade) + <LI>Björn Axelsson (Gecko) </UL> - </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/pyfaq.html =================================================================== --- trunk/atrinik/resource/HelpFiles/pyfaq.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/pyfaq.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,15 +19,19 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Help FAQ</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Help FAQ</TITLE> </HEAD> <BODY> -<P><A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> + <H1 align=center>Daimonin Java Script Editor FAQ</H1> <P> </P> + <P align="center">Comming Soon!</P> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/pyguide.html =================================================================== --- trunk/atrinik/resource/HelpFiles/pyguide.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/pyguide.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,14 +19,19 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Guidelines for Map-making</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Guidelines for Map-making</TITLE> </HEAD> <BODY> -<P><A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> + <H1 align=center>General Guidelines for Script-making</H1> + <H2 align=center> </H2> + <H2 align=center>comming soon!</H2> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/pystart.html =================================================================== --- trunk/atrinik/resource/HelpFiles/pystart.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/pystart.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,33 +19,41 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Daimonin Editor Help</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Daimonin Editor Help</TITLE> </HEAD> <BODY> -<H1 align=center><IMG SRC="cflogo.gif" WIDTH="378" HEIGHT="125" ALIGN="MIDDLE" NATURALSIZEFLAG="3"></H1> +<H1 align=center> + <IMG SRC="cflogo.gif" WIDTH="378" HEIGHT="125" ALIGN="MIDDLE" NATURALSIZEFLAG="3"> +</H1> + <H1 align=center>Daimonin Script Editor Help</H1> -<P><font size="+1">Welcome to the Daimonin Script Editor online Help.<br> - This document was designed to explain how to use the Script Editor.</font></P> +<P><font size="+1">Welcome to the Daimonin Script Editor online Help. + <br> + This document was designed to explain how to use the Script Editor.</font> +</P> <H3>Contents:</H3> <UL> - <LI><A HREF="pycredits.html">Credits</A> - <LI>Tutorial - <ol> - <LI><A HREF="tut_intro.html">Introduction to python</A> - <LI><A HREF="tut_DScript.html">Daimonin scripting commands</A> - </ol> + <LI><A HREF="pycredits.html">Credits</A> + <LI>Tutorial + <ol> + <LI><A HREF="tut_intro.html">Introduction to python</A> + <LI><A HREF="tut_DScript.html">Daimonin scripting commands</A> + </ol> - <LI><A HREF="pyguide.html">General Guidelines for Script-making</A> - <LI><A HREF="pyfaq.html">Daimonin Script Editor Help FAQ</A> + <LI><A HREF="pyguide.html">General Guidelines for Script-making</A> + <LI><A HREF="pyfaq.html">Daimonin Script Editor Help FAQ</A> </UL> <p>We hope you enjoy using the Daimonin Java Script Editor!</p> -<p><font size="-1">--Michael Toennies / Andreas Vogl / Peter Plischewsky / 'Bjorn - Axelson' </font></p> + +<p><font size="-1">--Michael Toennies / Andreas Vogl / Peter Plischewsky / + 'Bjorn Axelson'</font></p> + <p><font size="-1"> aka's : Michtoen / Andreas / Rustyblade / Gecko</font></p> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/start.html =================================================================== --- trunk/atrinik/resource/HelpFiles/start.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/start.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,40 +19,46 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Daimonin Editor Help</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Daimonin Editor Help</TITLE> </HEAD> <BODY> -<H1 align=center><IMG SRC="cflogo.gif" WIDTH="378" HEIGHT="125" ALIGN="MIDDLE" NATURALSIZEFLAG="3"></H1> +<H1 align=center> + <IMG SRC="cflogo.gif" WIDTH="378" HEIGHT="125" ALIGN="MIDDLE" NATURALSIZEFLAG="3"> +</H1> + <H1 align=center>Daimonin Editor Help</H1> -<P>Welcome to the Daimonin Editor online Help.<br> -This document was designed to explain how to use the Editor.</P> +<P>Welcome to the Daimonin Editor online Help. + <br> + This document was designed to explain how to use the Editor. +</P> <H3>Contents:</H3> <UL> - <LI><A HREF="credits.html">Credits</A> + <LI><A HREF="credits.html">Credits</A> - <LI>Tutorial - <ol> - <LI><A HREF="tut_loading.html">Loading Arches and Maps</A> - <LI><A HREF="tut_frames.html">The different Frames and their Purpose</A> - <LI><A HREF="tut_map.html">Basics for Designing a Map</A> - <LI><A HREF="tut_copypaste.html">Cut/Copy/Paste and Fill</A> - <LI><A HREF="tut_mapattr.html">Modifying the Map Properties</A> - <LI><A HREF="tut_objects.html">Manipulating Objects</A> - <LI><A HREF="tut_view.html">The View Settings</A> - <LI><A HREF="treasurelists.html">Treasurelists</A> - <LI><a href="tut_scriptev.html">Script Events</a> - </ol> + <LI>Tutorial + <ol> + <LI><A HREF="tut_loading.html">Loading Arches and Maps</A> + <LI><A HREF="tut_frames.html">The different Frames and their + Purpose</A> + <LI><A HREF="tut_map.html">Basics for Designing a Map</A> + <LI><A HREF="tut_copypaste.html">Cut/Copy/Paste and Fill</A> + <LI><A HREF="tut_mapattr.html">Modifying the Map Properties</A> + <LI><A HREF="tut_objects.html">Manipulating Objects</A> + <LI><A HREF="tut_view.html">The View Settings</A> + <LI><A HREF="treasurelists.html">Treasurelists</A> + <LI><a href="tut_scriptev.html">Script Events</a> + </ol> - <LI><A HREF="guide.html">General Guidelines for Map-making</A> + <LI><A HREF="guide.html">General Guidelines for Map-making</A> - <LI><A HREF="faq.html">Daimonin Editor Help FAQ</A> + <LI><A HREF="faq.html">Daimonin Editor Help FAQ</A> </UL> -I hope you enjoy using the Daimonin Java Editor. ---Andreas Vogl +I hope you enjoy using the Daimonin Java Editor. --Andreas Vogl + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/treasure_multi.html =================================================================== --- trunk/atrinik/resource/HelpFiles/treasure_multi.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/treasure_multi.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,39 +19,47 @@ <HTML> <HEAD> - <TITLE>Treasurelists Multi</TITLE> + <TITLE>Treasurelists Multi</TITLE> </HEAD> <BODY> -<P><A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>Treasurelists producing multiple items</H1> -<P>You can recognize this type of treasurelist by the icon: <IMG SRC="treasure_list.png" WIDTH="32" HEIGHT="20" ALIGN="BOTTOM">. -Such a treasurelist can produce multiple items from the list. Objects with no chance set -are always generated - Others are only generated when they succeed a random-roll -at the given chance.</P> +<P>You can recognize this type of treasurelist by the icon: + <IMG SRC="treasure_list.png" WIDTH="32" HEIGHT="20" ALIGN="BOTTOM">. Such a + treasurelist can produce multiple items from the list. Objects with no + chance set are always generated - Others are only generated when they + succeed a random-roll at the given chance.</P> + <P> -Look at the example below, the "giant" treasurelist:<br> -Club, throwing skill and boulders will always be generated. -Gold coins have a chance of 65% to be generated, and there -is only a 10% chance that one item out of the giant_parts list -is generated. -Numbers like in "<b>80</b> goldcoin" indicate that if chance succeeds, -a stack of 1-80 gold coins can appear.<br> + Look at the example below, the "giant" treasurelist: + <br> + Club, throwing skill and boulders will always be generated. Gold coins have + a chance of 65% to be generated, and there is only a 10% chance that one + item out of the giant_parts list is generated. Numbers like in "<b>80</b> + goldcoin" indicate that if chance succeeds, a stack of 1-80 gold coins can + appear. + <br> </P> <IMG SRC="treasure3.jpg" WIDTH="242" HEIGHT="202" ALIGN="CENTER"> + <P> -Note that chances of different items do not influence each other in any way. -However, the YES/NO option allows to set dependencies between items. -Look at the example below, the "goblin" treasurelist:<br> -There is a 10% chance for the bow to be generated. Now <b>if</b> the bow -is generated, automatically arrows are generated too.<br> -There is a 5% chance for the sword to be generated. If that fails, the -shortsword has a 10% chance to be generated. If that fails again, there -is a 15% chance for the dagger. -<br></P> + Note that chances of different items do not influence each other in any way. + However, the YES/NO option allows to set dependencies between items. Look at + the example below, the "goblin" treasurelist: + <br> + There is a 10% chance for the bow to be generated. Now <b>if</b> the bow is + generated, automatically arrows are generated too. + <br> + There is a 5% chance for the sword to be generated. If that fails, the + shortsword has a 10% chance to be generated. If that fails again, there is a + 15% chance for the dagger. + <br> +</P> <IMG SRC="treasure4.jpg" WIDTH="277" HEIGHT="366" ALIGN="CENTER"> -<br> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/treasure_one.html =================================================================== --- trunk/atrinik/resource/HelpFiles/treasure_one.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/treasure_one.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,31 +19,38 @@ <HTML> <HEAD> - <TITLE>Treasurelists One</TITLE> + <TITLE>Treasurelists One</TITLE> </HEAD> <BODY> -<P><A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>Treasurelists producing one item</H1> -<P>You can recognize this type of treasurelist by the icon: <IMG SRC="treasureone_list.png" WIDTH="32" HEIGHT="20" ALIGN="BOTTOM">, -as well as the name ending with "[one]". Such a treasurelist produces always -exactly one item from the list. The objects on the list can have different chances set -(the %-values in brackets), which indicate that some items are more likely to -get chosen, and other less likely. +<P>You can recognize this type of treasurelist by the icon: + <IMG SRC="treasureone_list.png" WIDTH="32" HEIGHT="20" ALIGN="BOTTOM">, as + well as the name ending with "[one]". Such a treasurelist produces always + exactly one item from the list. The objects on the list can have different + chances set (the %-values in brackets), which indicate that some items are + more likely to get chosen, and other less likely.</P> + +<P><b>Examples for treasurelists producing one item:</b> + + <br> </P> -<P><b>Examples for treasurelists producing one item:</b> -<br></P> <table border="1"> -<tr> -<td><IMG SRC="treasure1.jpg" WIDTH="219" HEIGHT="155" ALIGN="CENTER"></td> -<td><IMG SRC="treasure2.jpg" WIDTH="257" HEIGHT="87" ALIGN="CENTER"></td> -</tr> + <tr> + <td><IMG SRC="treasure1.jpg" WIDTH="219" HEIGHT="155" ALIGN="CENTER"> + </td> + <td><IMG SRC="treasure2.jpg" WIDTH="257" HEIGHT="87" ALIGN="CENTER"> + </td> + </tr> </table> <P>As you can see in the right hand side example, treasurelists may contain yet -other treasurelists. If chosen, such sub-lists get processed in recursive fashion. -You can view the contents of each sub-list by clicking on the expand-mark. -</P> + other treasurelists. If chosen, such sub-lists get processed in recursive + fashion. You can view the contents of each sub-list by clicking on the + expand-mark.</P> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/treasure_special.html =================================================================== --- trunk/atrinik/resource/HelpFiles/treasure_special.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/treasure_special.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,29 +19,31 @@ <HTML> <HEAD> - <TITLE>Special Treasurelists</TITLE> + <TITLE>Special Treasurelists</TITLE> </HEAD> <BODY> -<P><A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="treasurelists.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> <H1 align=center>Special Treasurelists</H1> -<P>Some treasurelists are used for special purposes. These can be found in -the sub-folders "God Intervention", "Dragon Player Evolution" and "Player Creation". -They cannot be used in maps. -</P> +<P>Some treasurelists are used for special purposes. These can be found in the + sub-folders "God Intervention", "Dragon Player Evolution" and "Player + Creation". They cannot be used in maps.</P> + <P> -The "God Intervention" lists are of special importance. They define which -bonuses the Daimonin gods donate to their worshippers. These lists are -traversed from top to bottom and the grace_limit objects are only passed -when the worshipping player has a certain amount of grace. + The "God Intervention" lists are of special importance. They define which + bonuses the Daimonin gods donate to their worshippers. These lists are + traversed from top to bottom and the grace_limit objects are only passed + when the worshipping player has a certain amount of grace.</P> + +<P> + Below you see the treasurelist of the god Gnarg (as of 24.10.2002, the list + might have changed in the meantime). + <br> </P> -<P> -Below you see the treasurelist of the god Gnarg (as of 24.10.2002, -the list might have changed in the meantime). -<br></P> <IMG SRC="treasure5.jpg" WIDTH="310" HEIGHT="602" ALIGN="CENTER"> -<br> + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/treasurelists.html =================================================================== --- trunk/atrinik/resource/HelpFiles/treasurelists.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/treasurelists.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,32 +19,38 @@ <HTML> <HEAD> - <TITLE>Treasurelists</TITLE> + <TITLE>Treasurelists</TITLE> </HEAD> <BODY> -<P><A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> +<P> + <A HREF="start.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> + <H1 align=center>Treasurelists</H1> <H3>What are Treasurelists?</H3> -<P>Whenever a monster is generated or loaded in the world of Daimonin, -items are placed in it's inventory according to the monster's -treasurelist.<br> -Hence, treasurelists define what items get dropped when the monster -is killed. Even more importantly, they define which skills and spells the -monster has at it's disposal.</P> + +<P>Whenever a monster is generated or loaded in the world of Daimonin, items are + placed in it's inventory according to the monster's treasurelist. + <br> + Hence, treasurelists define what items get dropped when the monster is + killed. Even more importantly, they define which skills and spells the + monster has at it's disposal. +</P> <P> -You can view the treasurelists by selecting menu "Resources->View Treasurelists", -or from the <A HREF="tut_objects.html">attribute dialog</A>. -<br></P> + You can view the treasurelists by selecting menu "Resources->View + Treasurelists", or from the <A HREF="tut_objects.html">attribute dialog</A>. + <br> +</P> <H3>Contents:</H3> <ol> - <LI><A HREF="treasure_one.html">Treasurelists producing one item</A> - <LI><A HREF="treasure_multi.html">Treasurelists producing multiple items</A> - <LI><A HREF="treasure_special.html">Special Treasurelists</A> + <LI><A HREF="treasure_one.html">Treasurelists producing one item</A> + <LI><A HREF="treasure_multi.html">Treasurelists producing multiple items</A> + <LI><A HREF="treasure_special.html">Special Treasurelists</A> </ol> To read more, select one of the links above. + </BODY> </HTML> Modified: trunk/atrinik/resource/HelpFiles/tut_DScript.html =================================================================== --- trunk/atrinik/resource/HelpFiles/tut_DScript.html 2010-05-22 22:29:02 UTC (rev 7896) +++ trunk/atrinik/resource/HelpFiles/tut_DScript.html 2010-05-23 09:08:24 UTC (rev 7897) @@ -19,874 +19,1726 @@ <HTML> <HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> - <TITLE>Daimonin Script Commands</TITLE> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> + <TITLE>Daimonin Script Commands</TITLE> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</HEAD> <BODY> -<P><A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> -<H1 align=center><font size="+4">Daimonin Scripting Commands<a name="DSC"></a><a></a></font></H1> +<P> + <A HREF="pystart.html"><IMG SRC="back.gif" WIDTH="42" HEIGHT="22" ALIGN="BOTTOM" NATURALSIZEFLAG="3" BORDER="0">Back</A> + +<H1 align=center><font size="+4">Daimonin Scripting + Commands<a name="DSC"></a><a></a></font></H1> + <H1 align=center><font size="+1">There are three different types or groups of - Daimonin Scripting Commands. They are:</font></H1> + Daimonin Scripting Commands. They are:</font></H1> + <H1 align=center><font color="#000000" size="+2"><strong><a href="#DFunc">Daimonin - Functions</a>, <a href="#MMeth">Map Methods</a> & <a href="#OMeth">Object - Methods</a></strong></font></H1> -<H1 align=center><font color="#000000" size="+1">Click on one of the above topics - to be taken to that subject.</font></H1> + Functions</a>, <a href="#MMeth">Map Methods</a> & <a href="#OMeth">Object + Methods</a></strong></font></H1> -<P><strong><font size="+2">Daimonin Functions:<a name="DFunc"></a> </font></strong><a href="#DSC">back - to the top</a></P> -<P>LoadObject<br> - ------------------------------------------------------------<br> - Daimonin.LoadObject(string)<br> - Parameter types:<br> - string string<br> - Possible return types:<br> - object<br> - Status:<br> - Untested</P> -<p>MatchString<br> - ------------------------------------------------------------<br> - Daimonin.MatchString(firststr,secondstr)<br> - Case insensitive string comparison. Returns 1 if the two<br> - strings are the same, or 0 if they differ.<br> - second string can contain regular expressions.<br> - Parameter types:<br> - string firststr<br> - string secondstr<br> - Possible return types:<br> - integer<br> - Status:<br> - Stable</p> -<p>ReadyMap<br> - ------------------------------------------------------------<br> - Daimonin.ReadyMap(name, unique)<br> - Make sure the named map is loaded into memory. unique _must_ be<br> - 1 if the map is unique (f_unique = 1).<br> - Default value for unique is 0<br> - Parameter types:<br> - string name<br> - (optional) integer unique<br> - Possible return types:<br> - map<br> - Status:<br> - Stable<br> - TODO:<br> - Don't crash if unique is wrong</p> -<p>CheckMap<br> - ------------------------------------------------------------<br> - Daimonin.CheckMap(arch, map_path, x, y)<br> - <br> - Parameter types:<br> - string arch<br> - string map_path<br> - integer x<br> - integer y<br> - Possible return types:<br> - object<br> - Status:<br> - Unfinished!! Do Not Use!</p> -<p>FindPlayer<br> - ------------------------------------------------------------<br> - Daimonin.FindPlayer(name)<br> - Parameter types:<br> - string name<br> - Possible return types:<br> - object<br> - Status:<br> - Tested</p> -<p>WhoAmI<br> - ------------------------------------------------------------<br> - Daimonin.WhoAmI()<br> - Get the owner of the active script (the object that has the<br> - event handler)<br> - Parameter types:<br> - Possible return types:<br> - object<br> - Status:<br> - Stable</p> -<p>WhoIsActivator<br> - ------------------------------------------------------------<br> - Daimonin.WhoIsActivator()<br> - Gets the object that activated the current event<br> - Parameter types:<br> - Possible return types:<br> - object<br> - Status:<br> - Stable</p> -<p>WhoIsOther<br> - ------------------------------------------------------------<br> - Daimonin.WhoIsOther()<br> - Parameter types:<br> - Possible return types:<br> - object<br> - Status:<br> - Untested</p> -<p>WhatIsMessage<br> - ------------------------------------------------------------<br> - Daimonin.WhatIsMessage()<br> - Gets the actual message in SAY events.<br> - Parameter types:<br> - Possible return types:<br> - string<br> - Status:<br> - Stable</p> -<p>GetOptions <br> - -------------------------------------------------------------<br> - Gets the script options (as passed in the event's slaying field)<br> - Parameter types: None<br> - Return types: String<br> - Status: Stable</p> -<p>GetReturnValue<br> - ------------------------------------------------------------<br> - Daimonin.GetReturnValue()<br> - Parameter types:<br> - Possible return types:<br> - integer<br> - Status:<br> - Untested</p> -<p>SetReturnValue<br> - ------------------------------------------------------------<br> - Daimonin.SetReturnValue(value)<br> - Parameter types:<br> - integer value<br> - Possible return types:<br> - None<br> - Status:<br> - Untested</p> -<p>GetSpellNr<br> - ------------------------------------------------------------<br> - Daimonin.GetSpellNr(name)<br> - Gets the number of the named spell. -1 if no such spell exists<br> - Parameter types:<br> - string name<br> - Possible return types:<br> - integer<br> - Status:<br> - Tested</p> -<p>GetSkillNr<br> - ------------------------------------------------------------<br> - Daimonin.GetSkillNr(name)<br> - Gets the number of the named skill. -1 if no such skill exists<br> - Parameter types:<br> - string name<br> - Possible return types:<br> - integer<br> - Status:<br> - Tested</p> -<p>RegisterCommand<br> - ------------------------------------------------------------<br> - Daimonin.RegisterCommand(cmdname,scriptname,speed)<br> - Parameter types:<br> - string cmdname<br> - string scriptname<br> - integer speed<br> - Possible return types:<br> - None<br> - Status:<br> - Untested<br> - pretty untested...</p> +<H1 align=center><font color="#000000" size="+1">Click on one of the above + topics to be taken to that subject.</font></H1> + +<P><strong><font size="+2">Daimonin Functions:<a name="DFunc"></a> +</font></strong><a href="#DSC">back to the top</a></P> + +<P>LoadObject + <br> + ------------------------------------------------------------ + <br> + Daimonin.LoadObject(string) + <br> + Parameter types: + <br> + string string + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Untested +</P> +<p>MatchString + <br> + ------------------------------------------------------------ + <br> + Daimonin.MatchString(firststr,secondstr) + <br> + Case insensitive string comparison. Returns 1 if the two + <br> + strings are the same, or 0 if they differ. + <br> + second string can contain regular expressions. + <br> + Parameter types: + <br> + string firststr + <br> + string secondstr + <br> + Possible return types: + <br> + integer + <br> + Status: + <br> + Stable +</p> +<p>ReadyMap + <br> + ------------------------------------------------------------ + <br> + Daimonin.ReadyMap(name, unique) + <br> + Make sure the named map is loaded into memory. unique _must_ be + <br> + 1 if the map is unique (f_unique = 1). + <br> + Default value for unique is 0 + <br> + Parameter types: + <br> + string name + <br> + (optional) integer unique + <br> + Possible return types: + <br> + map + <br> + Status: + <br> + Stable + <br> + TODO: + <br> + Don't crash if unique is wrong +</p> +<p>CheckMap + <br> + ------------------------------------------------------------ + <br> + Daimonin.CheckMap(arch, map_path, x, y) + <br> + <br> + Parameter types: + <br> + string arch + <br> + string map_path + <br> + integer x + <br> + integer y + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Unfinished!! Do Not Use! +</p> +<p>FindPlayer + <br> + ------------------------------------------------------------ + <br> + Daimonin.FindPlayer(name) + <br> + Parameter types: + <br> + string name + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Tested +</p> +<p>WhoAmI + <br> + ------------------------------------------------------------ + <br> + Daimonin.WhoAmI() + <br> + Get the owner of the active script (the object that has the + <br> + event handler) + <br> + Parameter types: + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Stable +</p> +<p>WhoIsActivator + <br> + ------------------------------------------------------------ + <br> + Daimonin.WhoIsActivator() + <br> + Gets the object that activated the current event + <br> + Parameter types: + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Stable +</p> +<p>WhoIsOther + <br> + ------------------------------------------------------------ + <br> + Daimonin.WhoIsOther() + <br> + Parameter types: + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Untested +</p> +<p>WhatIsMessage + <br> + ------------------------------------------------------------ + <br> + Daimonin.WhatIsMessage() + <br> + Gets the actual message in SAY events. + <br> + Parameter types: + <br> + Possible return types: + <br> + string + <br> + Status: + <br> + Stable +</p> +<p>GetOptions + <br> + ------------------------------------------------------------- + <br> + Gets the script options (as passed in the event's slaying field) + <br> + Parameter types: None + <br> + Return types: String + <br> + Status: Stable +</p> +<p>GetReturnValue + <br> + ------------------------------------------------------------ + <br> + Daimonin.GetReturnValue() + <br> + Parameter types: + <br> + Possible return types: + <br> + integer + <br> + Status: + <br> + Untested +</p> +<p>SetReturnValue + <br> + ------------------------------------------------------------ + <br> + Daimonin.SetReturnValue(value) + <br> + Parameter types: + <br> + integer value + <br> + Possible return types: + <br> + None + <br> + Status: + <br> + Untested +</p> +<p>GetSpellNr + <br> + ------------------------------------------------------------ + <br> + Daimonin.GetSpellNr(name) + <br> + Gets the number of the named spell. -1 if no such spell exists + <br> + Parameter types: + <br> + string name + <br> + Possible return types: + <br> + integer + <br> + Status: + <br> + Tested +</p> +<p>GetSkillNr + <br> + ------------------------------------------------------------ + <br> + Daimonin.GetSkillNr(name) + <br> + Gets the number of the named skill. -1 if no such skill exists + <br> + Parameter types: + <br> + string name + <br> + Possible return types: + <br> + integer + <br> + Status: + <br> + Tested +</p> +<p>RegisterCommand + <br> + ------------------------------------------------------------ + <br> + Daimonin.RegisterCommand(cmdname,scriptname,speed) + <br> + Parameter types: + <br> + string cmdname + <br> + string scriptname + <br> + integer speed + <br> + Possible return types: + <br> + None + <br> + Status: + <br> + Untested + <br> + pretty untested... +</p> <p> </p> -<p><strong><font size="+2">Map Methods<a name="MMeth"></a> </font></strong><a href="#DSC">back - to the top</a></p> -<p>GetFirstObjectOnSquare<br> - ------------------------------------------------------------<br> - map.GetFirstObjectOnSquare(x,y)<br> - Gets the bottom object on the tile. Use obj.above to browse objs<br> - Parameter types:<br> - integer x<br> - integer y<br> - Possible return types:<br> - object<br> - Status:<br> - Stable</p> -<p>MapTileAt<br> - ------------------------------------------------------------<br> - map.MapTileAt(x,y)<br> - Parameter types:<br> - integer x<br> - integer y<br> - Possible return types:<br> - map<br> - Status:<br> - untested<br> - TODO:<br> - do something about the new modified coordinates too?</p> -<p>PlaySound<br> - ------------------------------------------------------------<br> - map.PlaySound(x, y, soundnumber, soundtype)<br> - Parameter types:<br> - integer x<br> - integer y<br> - integer soundnumber<br> - integer soundtype<br> - Possible return types:<br> - None<br> - Status:<br> - Tested<br> - TODO:<br> - supply constants for the sounds</p> -<p>Message<br> - ------------------------------------------------------------<br> - map.Message(message, color)<br> - Writes a message to all players on a map<br> - default color is NDI_BLUE|NDI_UNIQUE<br> - Parameter types:<br> - string message<br> - (optional) integer color<br> - Possible return types:<br> - None<br> - Status:<br> - Tested<br> - TODO:<br> - Add constants for colors</p> -<p>CreateObject<br> - ------------------------------------------------------------<br> - map.CreateObject(arch_name, x, y)<br> - <br> - Parameter types:<br> - string arch_name<br> - integer x<br> - integer y<br> - Possible return types:<br> - object<br> - Status:<br> - Untested</p> + +<p><strong><font size="+2">Map Methods<a name="MMeth"></a> +</font></strong><a href="#DSC">back to the top</a></p> + +<p>GetFirstObjectOnSquare + <br> + ------------------------------------------------------------ + <br> + map.GetFirstObjectOnSquare(x,y) + <br> + Gets the bottom object on the tile. Use obj.above to browse objs + <br> + Parameter types: + <br> + integer x + <br> + integer y + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Stable +</p> +<p>MapTileAt + <br> + ------------------------------------------------------------ + <br> + map.MapTileAt(x,y) + <br> + Parameter types: + <br> + integer x + <br> + integer y + <br> + Possible return types: + <br> + map + <br> + Status: + <br> + untested + <br> + TODO: + <br> + do something about the new modified coordinates too? +</p> +<p>PlaySound + <br> + ------------------------------------------------------------ + <br> + map.PlaySound(x, y, soundnumber, soundtype) + <br> + Parameter types: + <br> + integer x + <br> + integer y + <br> + integer soundnumber + <br> + integer soundtype + <br> + Possible return types: + <br> + None + <br> + Status: + <br> + Tested + <br> + TODO: + <br> + supply constants for the sounds +</p> +<p>Message + <br> + ------------------------------------------------------------ + <br> + map.Message(message, color) + <br> + Writes a message to all players on a map + <br> + default color is NDI_BLUE|NDI_UNIQUE + <br> + Parameter types: + <br> + string message + <br> + (optional) integer color + <br> + Possible return types: + <br> + None + <br> + Status: + <br> + Tested + <br> + TODO: + <br> + Add constants for colors +</p> +<p>CreateObject + <br> + ------------------------------------------------------------ + <br> + map.CreateObject(arch_name, x, y) + <br> + <br> + Parameter types: + <br> + string arch_name + <br> + integer x + <br> + integer y + <br> + Possible return types: + <br> + object + <br> + Status: + <br> + Untested +</p> <p></p> -<p><font size="+2"><strong>Object Methods<a name="OMeth"></a> </strong></font><a href="#DSC">back - to the top</a></p> -<p>GetSkill<br> - ------------------------------------------------------------<br> - object.GetSkill(type, id) <br> - This function will fetch a skill or the exp of the skill<br> - Parameter types:<br> - integer skill<br> - integer type<br> - Possible return types:<br> - integer<br> - Status:<br> - Stable</p> -<p>SetSkill<br> - ------------------------------------------------------------<br> - object.SetSkill(skillid,value) <br> - Sets object's experience in the skill skillid as close to value<br> - as permitted. There is currently a limit of 1/4 of a level.<br> - There's no limit on exp reduction<br> - FIXME overall experience is not changed (should it be?) <br> - Parameter types:<br> - integer skillid<br> - integer value<br> - Possible return types:<br> - None<br> - Status:<br> - Tested</p> -<p>ActivateRune<br> - ------------------------------------------------------------<br> - object.ActivateRune(what)<br> - Parameter types:<br> - object what<br> - Possible return types:<br> - None<br> - Status:<br> - Untested</p> -<p>CheckTrigger<br> - ------------------------------------------------------------<br> - object.CheckTrigger(what)<br> - Parameter types:<br> - object what<br> - Possible return types:<br> - None<br> - Status:<br> - Unfinished<br> - MUST DO THE HOOK HERE !</p> -<p>GetGod<br> - ------------------------------------------------------------<br> - object.GetGod()<br> - Parameter types:<br> - Possible return types:<br> - string<br> - Status:<br> - Stable</p> -<p>SetGod<br> - ------------------------------------------------------------<br> - object.SetGod(godname)<br> - Parameter types:<br> - string godname<br> - Possible return types:<br> - None<br> - Status:<br> - Unfinished!</p> -<p>TeleportTo<br> - ------------------------------------------------------------<br> - object.TeleportTo(map, x, y, unique)<br> - Teleports object to the given position of map.<br> - Parameter types:<br> - string map<br> - integer x<br> - integer y<br> - (optional) integer unique<br> - Possible return types:<br> - None<br> - Status:<br> - Tested</p> -<p>InsertInside<br> - ------------------------------------------------------------<br> - object.InsertInside(where)<br> - Inserts object into where.<br> - Parameter types:<br> - object where<br> - Possible return types:<br> - None<br> - Status:<br> - Stable</p> -<p>Apply<br> - ------------------------------------------------------------<br> - object.Apply(what, flags)<br> - forces object to apply what.<br> - flags should be a reasonable combination of the following:<br> - Daimonin.APPLY_TOGGLE - normal apply (toggle)<br> - Daimonin.APPLY_ALWAYS - always apply (never unapply)<br> - Daimonin.UNAPPLY_ALWAYS - always unapply (never apply)<br> - Daimonin.UNAPPLY_NOMERGE - don't merge unapplied items<br> - Daimonin.UNAPPLY_IGNORE_CURSE - unapply cursed items<br> - returns: 0 - object cannot apply objects of that type.<br> - 1 - object was applied, or not...<br> - 2 - object must be in inventory to be applied<br> - Parameter types:<br> - object what<br> - integer flags<br> - Possible return types:<br> - integer<br> - Status:<br> - Tested</p> -<p>PickUp<br> - ------------------------------------------------------------<br> - object.PickUp(what)<br> - Parameter types:<br> - object what<br> - Possible return types:<br> - None<br> - Status:<br> - Tested</p> -<p>Drop<br> - ------------------------------------------------------------<br> - object.Drop(what)<br> - Equivalent to the player command "drop" (name is an object name,<br> - "all", "unpaid", "cursed", "unlocked" - or a count + object name :<br> - "<nnn> <object name>", or a base name, or a short name...)<br> - Parameter types:<br> - string what<br> - Possible return types:<br> - None<br> - Status:<br> - Tested</p> -<p>Take<br> - ------------------------------------------------------------<br> - object.Take(name)<br> - Parameter types:<br> - string name<br> - Possible return types:<br> - None<br> - Status:<br> - Temporary disabled (see commands.c)</p> -<p>Communicate<br> - ------------------------------------------------------------<br> - object.Communicate(message)<br> - object says message to everybody on its map<br> - but instead of CFSay it is parsed for other npc or magic mouth<br> - Parameter types:<br> - string message<br> - Possible return types:<br> - None<br> - Status:<br> - Stable</p> -<p>Say<br> - ------------------------------------------------------------<br> - object.Say(message)<br> - object says message to everybody on its map<br> - Parameter types:<br> - string message<br> - Possible return types:<br> - None<br> - Status:<br> - Stable</p> -<p>SayTo<br> - ------------------------------------------------------------<br> - object.SayTo(target, message)<br> - NPC talks only to player but map get a "xx talks to" msg too.<br> - Parameter types:<br> - object target<br> - string message<br> - Possible return types:<br> - None<br> - Status:<br> - Stable</p> -<p>Write<br> - ------------------------------------------------------------<br> - who.Write(message , color)<br> - Writes a message to a specific player.<br> - Parameter types:<br> - string message<br> - (optional) integer color<br> - Possible return types:<br> - None<br> - Status:<br> - Tested</p> -<p>SetGender<br> - ------------------------------------------------------------<br> - object.SetGender(gender)<br> - Changes the gender of object. gender_string should be one of<br> - Daimonin.NEUTER, Daimonin.MALE, Daimonin.GENDER_FEMALE or<br> - Daimonin.HERMAPHRODITE<br> - Parameter types:<br> - integer gender<br> - Possible return types:<br> - None<br> - Status:<br> - Stable</p> -<p>SetRank<br> - ------------------------------------------------------------<br> - object.SetRank(rank_string)<br> - Set the rank of an object to rank_string<br> - Rank string 'Mr' is special for no rank<br> - Parameter types:<br> - string rank_string<br> - Possible return types:<br> - object<br> - None<br> - Status... [truncated message content] |
From: <aki...@us...> - 2010-05-22 22:29:09
|
Revision: 7896 http://gridarta.svn.sourceforge.net/gridarta/?rev=7896&view=rev Author: akirschbaum Date: 2010-05-22 22:29:02 +0000 (Sat, 22 May 2010) Log Message: ----------- Add @ActionMethod annotations. Modified Paths: -------------- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -63,6 +63,7 @@ import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.misc.JFileChooserButton; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -399,6 +400,7 @@ /** * Action method for help. */ + @ActionMethod public void mapHelp() { new Help(helpParent, "tut_mapattr.html").setVisible(true); } @@ -406,6 +408,7 @@ /** * Action method for okay. */ + @ActionMethod public void mapOkay() { if (modifyMapProperties()) { setValue(okButton); @@ -415,6 +418,7 @@ /** * Action method for restore. */ + @ActionMethod public void mapRestore() { restoreMapProperties(); } @@ -422,6 +426,7 @@ /** * Action method for cancel. */ + @ActionMethod public void mapCancel() { setValue(cancelButton); } Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -52,6 +52,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -238,6 +239,7 @@ /** * Action method for "search" button. */ + @ActionMethod public void findArchetypesSearch() { previousSearch = ""; doSearch(true); @@ -343,6 +345,7 @@ /** * Action method to scroll up one line in the result table. */ + @ActionMethod public void findArchetypesScrollUp() { final int index = resultTable.getSelectedRow(); if (index > 0) { @@ -353,6 +356,7 @@ /** * Action method to scroll down one line in the result table. */ + @ActionMethod public void findArchetypesScrollDown() { final int index = resultTable.getSelectedRow(); if (index != -1 && index + 1 < resultTableModel.getRowCount()) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -137,6 +137,7 @@ import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -1141,6 +1142,7 @@ /** * Action method for help. */ + @ActionMethod public void attribHelp() { new Help(/* XXX */ parent, archetypeType.createHtmlDocu()).setVisible(true); } @@ -1148,6 +1150,7 @@ /** * Action method for ok. */ + @ActionMethod public void attribOk() { if (applySettings()) { setValue(okButton); @@ -1157,6 +1160,7 @@ /** * Action method for apply. */ + @ActionMethod public void attribApply() { applySettings(); } @@ -1164,6 +1168,7 @@ /** * Action method for cancel. */ + @ActionMethod public void attribCancel() { setValue(cancelButton); } @@ -1172,6 +1177,7 @@ * Action method for summary. Switches the cardlayout to the summary list of * all nonzero attributes. */ + @ActionMethod public void attribSummary() { // interface is displayed, switch to summary final Document doc = summaryTextPane.getDocument(); @@ -1199,6 +1205,7 @@ * Turns the summary off. Switches to the input-interface for all attributes * and the summary list of all nonzero attributes. */ + @ActionMethod public void attribEdit() { summaryEditButton.setAction(summaryAction); cardLayout.show(centerPanel, "edit"); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -436,6 +436,7 @@ * @return <code>true</code> if the grid is visible, or <code>false</code> * if the grid is invisible */ + @ActionMethod public boolean isGridVisible() { return isGridVisibleEnabled() && mapViewSettings.isGridVisible(); } @@ -447,6 +448,7 @@ * invisible * @see #isGridVisible() */ + @ActionMethod public void setGridVisible(final boolean gridVisible) { if (isGridVisibleEnabled()) { mapViewSettings.setGridVisible(gridVisible); @@ -458,6 +460,7 @@ * @return <code>true</code> if smoothing is active, or <code>false</code> * if smoothing is disabled */ + @ActionMethod public boolean isSmoothing() { return isSmoothingEnabled() && mapViewSettings.isSmoothing(); } @@ -468,6 +471,7 @@ * smoothing should be active, <code>false</code> if deactivated * @see #isSmoothing() () */ + @ActionMethod public void setSmoothing(final boolean smoothing) { if (isSmoothingEnabled()) { mapViewSettings.setSmoothing(smoothing); @@ -479,6 +483,7 @@ * @return <code>true</code> if double faces are shwon, or * <code>false</code> if not */ + @ActionMethod public boolean isDoubleFaces() { return isDoubleFacesEnabled() && mapViewSettings.isDoubleFaces(); } @@ -488,6 +493,7 @@ * @param doubleFaces new value * @see #isDoubleFaces() */ + @ActionMethod public void setDoubleFaces(final boolean doubleFaces) { if (isDoubleFacesEnabled()) { mapViewSettings.setDoubleFaces(doubleFaces); @@ -499,6 +505,7 @@ * @return <code>true</code> if adjacent tiles are shown, or * <code>false</code> if adjacent tiles are not shown */ + @ActionMethod public boolean isTileShow() { return false; } @@ -507,6 +514,7 @@ * Action method for "tile show". * @param tileShow if set, show adjacent tiles */ + @ActionMethod public void setTileShow(final boolean tileShow) { // not yet implemented } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -48,6 +48,7 @@ import net.sf.gridarta.utils.CommonConstants; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; /** @@ -238,6 +239,7 @@ /** * Action method for tiles attaching automatically. */ + @ActionMethod public void mapTilesAttach() { final String[] tmpTilePaths = new String[tilePaths.length]; for (int i = 0; i < tmpTilePaths.length; i++) { @@ -267,6 +269,7 @@ /** * Action method for tiles clearing paths. */ + @ActionMethod public void mapTilesClear() { for (final MapTilePanel tilePath : tilePaths) { tilePath.getTilePanel().setText("", true); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -43,6 +43,7 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.action.ToggleAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -411,6 +412,7 @@ * Returns whether walls should not be deleted. * @return whether walls should not be deleted */ + @ActionMethod public boolean isDeletionToolExceptionsIgnoreWalls() { return deletionToolExceptionsIgnoreWalls; } @@ -420,6 +422,7 @@ * @param deletionToolExceptionsIgnoreWalls whether walls should not be * deleted */ + @ActionMethod public void setDeletionToolExceptionsIgnoreWalls(final boolean deletionToolExceptionsIgnoreWalls) { this.deletionToolExceptionsIgnoreWalls = deletionToolExceptionsIgnoreWalls; } @@ -428,6 +431,7 @@ * Returns whether floors should not be deleted. * @return whether floors should not be deleted */ + @ActionMethod public boolean isDeletionToolExceptionsIgnoreFloors() { return deletionToolExceptionsIgnoreFloors; } @@ -437,6 +441,7 @@ * @param deletionToolExceptionsIgnoreFloors whether floors should not be * deleted */ + @ActionMethod public void setDeletionToolExceptionsIgnoreFloors(final boolean deletionToolExceptionsIgnoreFloors) { this.deletionToolExceptionsIgnoreFloors = deletionToolExceptionsIgnoreFloors; } @@ -445,6 +450,7 @@ * Returns whether monsters should not be deleted. * @return whether monsters should not be deleted */ + @ActionMethod public boolean isDeletionToolExceptionsIgnoreMonsters() { return deletionToolExceptionsIgnoreMonsters; } @@ -454,6 +460,7 @@ * @param deletionToolExceptionsIgnoreMonsters whether monsters should not * be deleted */ + @ActionMethod public void setDeletionToolExceptionsIgnoreMonsters(final boolean deletionToolExceptionsIgnoreMonsters) { this.deletionToolExceptionsIgnoreMonsters = deletionToolExceptionsIgnoreMonsters; } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -41,6 +41,7 @@ import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.action.ToggleAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -248,6 +249,7 @@ * Returns whether auto-fill is enabled. * @return whether auto-fill is enabled */ + @ActionMethod public boolean isSelectionToolAutoFill() { return selectionToolAutoFill; } @@ -256,6 +258,7 @@ * Sets whether auto-fill is enabled. * @param selectionToolAutoFill whether auto-fill is enabled */ + @ActionMethod public void setSelectionToolAutoFill(final boolean selectionToolAutoFill) { if (this.selectionToolAutoFill == selectionToolAutoFill) { return; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -46,6 +46,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -197,6 +198,7 @@ /** * Action method for okay. */ + @ActionMethod public void mapOkay() { if (isOkButtonEnabled() && createNew()) { setValue(okButton); @@ -206,6 +208,7 @@ /** * Action method for cancel. */ + @ActionMethod public void mapCancel() { setValue(cancelButton); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -36,6 +36,7 @@ import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.prefs.AbstractPrefs; /** @@ -144,6 +145,7 @@ * Set AutoUpdate state. * @param autoUpdate autoupdate state */ + @ActionMethod public void setAutoUpdate(final boolean autoUpdate) { interval.setEnabled(autoUpdate); } @@ -152,6 +154,7 @@ * Get AutoUpdate state. * @return autoupdate state */ + @ActionMethod public boolean isAutoUpdate() { return interval.isEnabled(); } Modified: trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -39,6 +39,7 @@ import net.sf.gridarta.utils.CommonConstants; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -204,6 +205,7 @@ /** * Action method for ok. */ + @ActionMethod public void shrinkMapSizeDialogOk() { shrinkMapSize(); setValue(okButton); @@ -212,6 +214,7 @@ /** * Action method for cancel. */ + @ActionMethod public void shrinkMapSizeDialogCancel() { setValue(cancelButton); } @@ -253,6 +256,7 @@ /** * Action method for "shrinkMapSizeDialogEast". */ + @ActionMethod public boolean isShrinkMapSizeDialogEast() { return eastCheckBox.isSelected(); } @@ -260,6 +264,7 @@ /** * Action method for "shrinkMapSizeDialogEast". */ + @ActionMethod public void setShrinkMapSizeDialogEast(final boolean flag) { eastCheckBox.setSelected(!flag); updateWarnings(); @@ -268,6 +273,7 @@ /** * Action method for "shrinkMapSizeDialogSouth". */ + @ActionMethod public boolean isShrinkMapSizeDialogSouth() { return southCheckBox.isSelected(); } @@ -275,6 +281,7 @@ /** * Action method for "shrinkMapSizeDialogSouth". */ + @ActionMethod public void setShrinkMapSizeDialogSouth(final boolean flag) { southCheckBox.setSelected(!flag); updateWarnings(); Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -39,6 +39,7 @@ import net.sf.gridarta.textedit.textarea.SyntaxDocument; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; /** @@ -159,6 +160,7 @@ /** * Action method for okay. */ + @ActionMethod public void replaceButton() { textToFind = findTextField.getText(); textToReplace = replaceTextField.getText(); @@ -171,6 +173,7 @@ /** * Action method for cancel. */ + @ActionMethod public void cancelButton() { setValue(cancelButton); dialog.dispose(); Modified: trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-05-22 22:15:52 UTC (rev 7895) +++ trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-05-22 22:29:02 UTC (rev 7896) @@ -40,6 +40,7 @@ import javax.swing.SwingUtilities; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -253,6 +254,7 @@ /** * Action method for starting. */ + @ActionMethod public void controlStart() { synchronized (lock) { if (process != null) { @@ -293,6 +295,7 @@ /** * Action method for stopping. */ + @ActionMethod public void controlStop() { if (process != null) { process.destroy(); @@ -304,6 +307,7 @@ /** * Action method for clearing the log. */ + @ActionMethod public void controlClear() { stdtxt.setText(""); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 22:15:58
|
Revision: 7895 http://gridarta.svn.sourceforge.net/gridarta/?rev=7895&view=rev Author: akirschbaum Date: 2010-05-22 22:15:52 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove TokenMarker.supportsMultilineTokens(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxDocument.java trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxDocument.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxDocument.java 2010-05-22 22:13:07 UTC (rev 7894) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxDocument.java 2010-05-22 22:15:52 UTC (rev 7895) @@ -74,7 +74,7 @@ * @param len the number of lines, after the first one to parse */ private void tokenizeLines(final int start, final int len) { - if (tokenMarker == null || !TokenMarker.supportsMultilineTokens()) { + if (tokenMarker == null) { return; } Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2010-05-22 22:13:07 UTC (rev 7894) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2010-05-22 22:15:52 UTC (rev 7895) @@ -146,17 +146,6 @@ protected abstract byte markTokensImpl(byte token, Segment line, int lineIndex); /** - * Returns if the token marker supports tokens that span multiple lines. If - * this is true, the object using this token marker is required to pass all - * lines in the document to the <code>markTokens()</code> method (in - * turn).<p> <p/> The default implementation returns true; it should be - * overridden to return false on simpler token markers for increased speed. - */ - public static boolean supportsMultilineTokens() { - return true; - } - - /** * Informs the token marker that lines have been inserted into the document. * This inserts a gap in the <code>lineInfo</code> array. * @param index the first line number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 22:13:13
|
Revision: 7894 http://gridarta.svn.sourceforge.net/gridarta/?rev=7894&view=rev Author: akirschbaum Date: 2010-05-22 22:13:07 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unneeded return values. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java Modified: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-05-22 22:05:55 UTC (rev 7893) +++ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-05-22 22:13:07 UTC (rev 7894) @@ -99,15 +99,11 @@ final MapControl<G, A, R>[] mapControls = (MapControl<G, A, R>[]) new MapControl<?, ?, ?>[tilePaths.length]; try { // first action: we go around all links and try to load the maps - if (!loadAdjacentMaps(mapModel, mapControls, tilePaths)) { - return false; - } + loadAdjacentMaps(mapModel, mapControls, tilePaths); // We have loaded all direct linked maps around our map. // now, lets check free spaces. - if (!fillAdjacentMaps(mapControls)) { - return false; - } + fillAdjacentMaps(mapControls); validateMapSizes(mapModel, mapControls); @@ -134,10 +130,9 @@ * @param mapModel the map model * @param mapControls the return value * @param tilePaths the new tile paths - * @return whether all maps have been loaded * @throws CannotLoadMapFileException if a map file cannot be loaded */ - private boolean loadAdjacentMaps(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapControl<G, A, R>[] mapControls, @NotNull final String[] tilePaths) throws CannotLoadMapFileException { + private void loadAdjacentMaps(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapControl<G, A, R>[] mapControls, @NotNull final String[] tilePaths) throws CannotLoadMapFileException { for (int i = 0; i < tilePaths.length; i++) { final String path = tilePaths[i]; if (path != null && path.length() != 0) { @@ -148,7 +143,6 @@ } } } - return true; } /** @@ -176,10 +170,9 @@ /** * Fills missing adjacent map slots. * @param mapControls the loaded maps; will be updated - * @return whether all maps have been processed * @throws CannotLoadMapFileException if a map file cannot be loaded */ - private boolean fillAdjacentMaps(@NotNull final MapControl<G, A, R>[] mapControls) throws CannotLoadMapFileException { + private void fillAdjacentMaps(@NotNull final MapControl<G, A, R>[] mapControls) throws CannotLoadMapFileException { boolean repeatFlag = true; while (repeatFlag) { repeatFlag = false; @@ -205,7 +198,6 @@ } } } - return true; } /** Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java 2010-05-22 22:05:55 UTC (rev 7893) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java 2010-05-22 22:13:07 UTC (rev 7894) @@ -86,9 +86,7 @@ if (backslash) { backslash = false; } else if (cpp) { - if (doKeyword(line, i)) { - break; - } + doKeyword(line, i); addToken(i - lastOffset, currentToken); addToken(length - i, Token.KEYWORD2); lastOffset = length; @@ -123,9 +121,7 @@ case ':': if (lastKeyword == offset) { - if (doKeyword(line, i)) { - break; - } + doKeyword(line, i); backslash = false; addToken(i1 - lastOffset, Token.LABEL); lastOffset = i1; @@ -294,7 +290,7 @@ return cKeywords; } - private boolean doKeyword(final Segment line, final int i) { + private void doKeyword(final Segment line, final int i) { final int i1 = i + 1; final int len = i - lastKeyword; @@ -307,7 +303,6 @@ lastOffset = i; } lastKeyword = i1; - return false; } } // class CTokenMarker This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 22:06:01
|
Revision: 7893 http://gridarta.svn.sourceforge.net/gridarta/?rev=7893&view=rev Author: akirschbaum Date: 2010-05-22 22:05:55 +0000 (Sat, 22 May 2010) Log Message: ----------- Add final modifiers. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-22 22:02:27 UTC (rev 7892) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-22 22:05:55 UTC (rev 7893) @@ -70,7 +70,7 @@ * The original value. */ @NotNull - private String original; + private final String original; /** * The context reference for relative paths (file). Modified: trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-22 22:02:27 UTC (rev 7892) +++ trunk/src/app/net/sf/gridarta/model/filter/AbstractFilterConfig.java 2010-05-22 22:05:55 UTC (rev 7893) @@ -51,7 +51,7 @@ * The {@link Filter} this filter config belongs to. */ @NotNull - private F filter; + private final F filter; /** * Creates a new instance. Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-22 22:02:27 UTC (rev 7892) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-22 22:05:55 UTC (rev 7893) @@ -43,7 +43,7 @@ * instances to XML representation. */ @NotNull - private FilterConfigVisitor toXMLFilterConfigVisitor = new FilterConfigVisitor() { + private final FilterConfigVisitor toXMLFilterConfigVisitor = new FilterConfigVisitor() { @Override public void visit(@NotNull final NamedFilterConfig filterConfig) { @@ -89,7 +89,7 @@ * instances from XML representation. */ @NotNull - private FilterConfigVisitor fromXMLFilterConfigVisitor = new FilterConfigVisitor() { + private final FilterConfigVisitor fromXMLFilterConfigVisitor = new FilterConfigVisitor() { @Override public void visit(@NotNull final NamedFilterConfig filterConfig) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 22:02:34
|
Revision: 7892 http://gridarta.svn.sourceforge.net/gridarta/?rev=7892&view=rev Author: akirschbaum Date: 2010-05-22 22:02:27 +0000 (Sat, 22 May 2010) Log Message: ----------- Add private modifiers. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFacesLoader.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/gui/utils/tristate/TristateCheckBox.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/model/face/ColourFilter.java trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/app/net/sf/gridarta/utils/ActionUtils.java trunk/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFacesLoader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFacesLoader.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/smoothface/SmoothFacesLoader.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -91,7 +91,7 @@ * @param errorViewCollector the error view collector for reporting errors * @throws IOException if loadings fails */ - public static void load(@NotNull final String readerName, @NotNull final Reader reader, @NotNull final SmoothFaces smoothFaces, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { + private static void load(@NotNull final String readerName, @NotNull final Reader reader, @NotNull final SmoothFaces smoothFaces, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { int smoothEntries = 0; final BufferedReader bufferedReader = new BufferedReader(reader); try { Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -59,7 +59,7 @@ * Notification delay in milliseconds. All listeners will be notified this * delay after the last map change has happened. */ - public static final long DELAY = 500L; + private static final long DELAY = 500L; /** * The {@link MapManager} to track. Modified: trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -274,7 +274,7 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readUntil(@NotNull final BufferedReader stream, @NotNull final CharSequence tag) throws IOException { + private static String readUntil(@NotNull final BufferedReader stream, @NotNull final CharSequence tag) throws IOException { final StringBuilder sb = new StringBuilder(); int c; // character value, read from the stream int t = 0; // index Modified: trunk/src/app/net/sf/gridarta/gui/utils/tristate/TristateCheckBox.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tristate/TristateCheckBox.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/gui/utils/tristate/TristateCheckBox.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -86,7 +86,7 @@ * @param icon the icon to display * @param initialState the initial state */ - public TristateCheckBox(@NotNull final String text, @Nullable final Icon icon, @NotNull final TristateState initialState) { + private TristateCheckBox(@NotNull final String text, @Nullable final Icon icon, @NotNull final TristateState initialState) { this(text, icon, new TristateButtonModel(initialState)); } @@ -96,7 +96,7 @@ * @param icon the icon to display * @param buttonModel the button model to use */ - public TristateCheckBox(@NotNull final String text, @Nullable final Icon icon, @NotNull final ButtonModel buttonModel) { + private TristateCheckBox(@NotNull final String text, @Nullable final Icon icon, @NotNull final ButtonModel buttonModel) { super(text, icon); acceptMouseListeners = true; setModel(buttonModel); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -207,7 +207,7 @@ /** * Preferences. */ - protected static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); /** * The status bar instance. Modified: trunk/src/app/net/sf/gridarta/model/face/ColourFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/face/ColourFilter.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/model/face/ColourFilter.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -50,22 +50,22 @@ /** * The mask for selecting the alpha bits. */ - public static final int ALPHA_MASK = 0xFF000000; + private static final int ALPHA_MASK = 0xFF000000; /** * The bit-offset for the red bits. */ - public static final int RED_SHIFT = 16; + private static final int RED_SHIFT = 16; /** * The bit-offset for the green bits. */ - public static final int GREEN_SHIFT = 8; + private static final int GREEN_SHIFT = 8; /** * The bit-offset for the blue bits. */ - public static final int BLUE_SHIFT = 0; + private static final int BLUE_SHIFT = 0; /** * The positive mask to apply. Modified: trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -52,7 +52,7 @@ /** * Number of columns in the array. */ - public static final int X_DIM = 34; + private static final int X_DIM = 34; /** * Number of rows in the array. Modified: trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -54,7 +54,7 @@ * The preferences key for the media directory. */ @NotNull - public static final String MEDIA_DIRECTORY_KEY = "mediaDirectory"; + private static final String MEDIA_DIRECTORY_KEY = "mediaDirectory"; /** * The preferences key for the selected image set. @@ -90,7 +90,7 @@ /** * Preferences. */ - protected static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); /** * The default value for the maps directory. Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -56,7 +56,7 @@ /** * Python menu definitions. */ - public static final String PYTHONMENU_FILE = "cfpython_menu.def"; + private static final String PYTHONMENU_FILE = "cfpython_menu.def"; /** * The Logger for printing log messages. Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -218,7 +218,7 @@ * @return the key stroke or <code>null</code> if invalid */ @Nullable - public static KeyStroke parseKeyStroke(final String keyStroke) { + private static KeyStroke parseKeyStroke(final String keyStroke) { if (keyStroke == null) { return null; } Modified: trunk/src/app/net/sf/gridarta/utils/ActionUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/ActionUtils.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/utils/ActionUtils.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -36,7 +36,7 @@ * Action key for the action's category. */ @NotNull - public static final String CATEGORY = "Category"; + private static final String CATEGORY = "Category"; /** * Category value for {@link Action Actions} not defining a {@link @@ -136,7 +136,7 @@ * @return the shortcut or <code>null</code> */ @Nullable - public static KeyStroke getShortcut(@NotNull final Action action, @NotNull final String key) { + private static KeyStroke getShortcut(@NotNull final Action action, @NotNull final String key) { final Object acceleratorKey = action.getValue(key); return acceleratorKey instanceof KeyStroke ? (KeyStroke) acceleratorKey : null; } Modified: trunk/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-22 21:50:42 UTC (rev 7891) +++ trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-22 22:02:27 UTC (rev 7892) @@ -65,13 +65,13 @@ public static final String SQUARE_NOARCH = SYSTEM_DIR + "noarch.png"; - public static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"; + private static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"; - public static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"; + private static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"; - public static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"; + private static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"; - public static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"; + private static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"; /** The default map icon to use if no icon can be created. */ public static final String DEFAULT_ICON = SYSTEM_DIR + "default_icon.png"; @@ -83,11 +83,11 @@ private static final String CLOSE_TAB_SMALLICON = ICON_DIR + "CloseTabSmallIcon.gif"; - public static final String AUTORUN_SMALLICON = ICON_DIR + "AutorunSmallIcon.gif"; + private static final String AUTORUN_SMALLICON = ICON_DIR + "AutorunSmallIcon.gif"; - public static final String FILTER_SMALLICON = ICON_DIR + "FilterSmallIcon.gif"; + private static final String FILTER_SMALLICON = ICON_DIR + "FilterSmallIcon.gif"; - public static final String RUN_PLUGIN_SMALLICON = ICON_DIR + "RunPluginSmallIcon.gif"; + private static final String RUN_PLUGIN_SMALLICON = ICON_DIR + "RunPluginSmallIcon.gif"; /** * Application icon definitions (icon-dir). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:50:49
|
Revision: 7891 http://gridarta.svn.sourceforge.net/gridarta/?rev=7891&view=rev Author: akirschbaum Date: 2010-05-22 21:50:42 +0000 (Sat, 22 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java 2010-05-22 21:48:51 UTC (rev 7890) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/CTokenMarker.java 2010-05-22 21:50:42 UTC (rev 7891) @@ -130,8 +130,8 @@ addToken(i1 - lastOffset, Token.LABEL); lastOffset = i1; lastKeyword = i1; - } else if (doKeyword(line, i)) { - break; + } else { + doKeyword(line, i); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:48:57
|
Revision: 7890 http://gridarta.svn.sourceforge.net/gridarta/?rev=7890&view=rev Author: akirschbaum Date: 2010-05-22 21:48:51 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unneeded braces. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-05-22 21:48:15 UTC (rev 7889) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-05-22 21:48:51 UTC (rev 7890) @@ -117,17 +117,15 @@ root.addContent(c); final Element modes = new Element("mode"); - { - final Element autoboot = new Element("autoboot"); - autoboot.addContent(Boolean.toString(scriptModel.isAutoboot())); - final Element bash = new Element("bash"); - bash.addContent(Boolean.toString(scriptModel.isScript())); - final Element filter = new Element("filter"); - filter.addContent(Boolean.toString(scriptModel.isFilter())); - modes.addContent(autoboot); - modes.addContent(bash); - modes.addContent(filter); - } + final Element autoboot = new Element("autoboot"); + autoboot.addContent(Boolean.toString(scriptModel.isAutoboot())); + final Element bash = new Element("bash"); + bash.addContent(Boolean.toString(scriptModel.isScript())); + final Element filter = new Element("filter"); + filter.addContent(Boolean.toString(scriptModel.isFilter())); + modes.addContent(autoboot); + modes.addContent(bash); + modes.addContent(filter); root.addContent(modes); for (final PluginParameter<G, A, R, ?, ?> parameter : scriptModel) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:48:21
|
Revision: 7889 http://gridarta.svn.sourceforge.net/gridarta/?rev=7889&view=rev Author: akirschbaum Date: 2010-05-22 21:48:15 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unneeded parentheses. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterCellRenderer.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/src/app/net/sf/gridarta/script/ScriptModelLoader.java trunk/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -270,7 +270,7 @@ if (!archetype.isTail()) { final String archetypeName = archetype.getArchetypeName(); final String objName = archetype.getObjName(); - if (archetypeName.toLowerCase().contains(lowerCaseName) || (objName.toLowerCase().contains(lowerCaseName))) { + if (archetypeName.toLowerCase().contains(lowerCaseName) || objName.toLowerCase().contains(lowerCaseName)) { if (exactArchetypeNameMatch != null) { // ignore } else if (archetypeName.equals(name)) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -258,6 +258,7 @@ animated = false; } else { animated = gameObject.getAttributeInt("is_animated") != 0; + //noinspection UnnecessaryParentheses if (severity == Severity.DEFAULT && animated != (gameObject.getArchetype().getAttributeInt("is_animated") != 0)) { severity = Severity.MODIFIED; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterCellRenderer.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterCellRenderer.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -51,7 +51,7 @@ public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final String newVal; if (value instanceof MapControl) { - newVal = (((MapControl<?, ?, ?>) value).getMapModel().getMapArchObject().getMapName()); + newVal = ((MapControl<?, ?, ?>) value).getMapModel().getMapArchObject().getMapName(); } else { final MapControl<?, ?, ?> mapControl = mapManager.getCurrentMap(); final String mapName = mapControl != null ? mapControl.getMapModel().getMapArchObject().getMapName() : ""; Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -391,7 +391,7 @@ final RectangularShape bounds = list.getCellBounds(lastIndex, lastIndex); final int lowestY = (int) (bounds.getY() + bounds.getHeight()); - if ((int) (e.getPoint().getY()) >= lowestY) { + if ((int) e.getPoint().getY() >= lowestY) { return lastIndex + 1; } Modified: trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -485,7 +485,7 @@ top += rowHeight + vgap; } if (cSE != null) { - cSE.setBounds(left + (colWidth + hgap), top, colWidth, rowHeight); + cSE.setBounds(left + colWidth + hgap, top, colWidth, rowHeight); } } } Modified: trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -286,7 +286,7 @@ @NotNull @Override public G getTopContainer() { - return container != null && container instanceof GameObject ? (((GameObject<G, A, R>) container).getTopContainer()) : getThis(); + return container != null && container instanceof GameObject ? ((GameObject<G, A, R>) container).getTopContainer() : getThis(); } /** Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelLoader.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelLoader.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -113,7 +113,7 @@ } final Element elt = doc.getRootElement(); - if ((!elt.getName().equalsIgnoreCase("script"))) { + if (!elt.getName().equalsIgnoreCase("script")) { throw new IOException("missing root element named \"script\""); } Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java 2010-05-22 21:44:19 UTC (rev 7888) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/TextAreaPainter.java 2010-05-22 21:48:15 UTC (rev 7889) @@ -227,7 +227,7 @@ return; } - defaultCharWidth = (int) (Math.round((new TextLayout("WgGhdJj", font, fontRenderContext)).getAdvance() / 7.0)); + defaultCharWidth = (int) Math.round(new TextLayout("WgGhdJj", font, fontRenderContext).getAdvance() / 7.0); defaultLineHeight = Math.round(font.getLineMetrics("WgGhdJj", fontRenderContext).getHeight()); defaultFont = font; } @@ -714,7 +714,7 @@ if (textArea.isCaretVisible()) { final int offset = textArea.getCaretPosition() - textArea.getLineStartOffset(line); final int caretX = textArea.offsetToX2(line, offset); - final int caretWidth = ((blockCaret || textArea.isOverwriteEnabled()) ? fontMetrics.charWidth('w') : 1); + final int caretWidth = blockCaret || textArea.isOverwriteEnabled() ? fontMetrics.charWidth('w') : 1; final int yy = y + fontMetrics.getLeading() + fontMetrics.getMaxDescent(); final int height = fontMetrics.getHeight(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:44:25
|
Revision: 7888 http://gridarta.svn.sourceforge.net/gridarta/?rev=7888&view=rev Author: akirschbaum Date: 2010-05-22 21:44:19 +0000 (Sat, 22 May 2010) Log Message: ----------- Define .dtd files. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 21:40:28 UTC (rev 7887) +++ trunk/gridarta.ipr 2010-05-22 21:44:19 UTC (rev 7888) @@ -1165,6 +1165,11 @@ <module fileurl="file://$PROJECT_DIR$/utils.iml" filepath="$PROJECT_DIR$/utils.iml" /> </modules> </component> + <component name="ProjectResources"> + <resource url="types.dtd" location="$PROJECT_DIR$/resource/system/dtd/types.dtd" /> + <resource url="GameObjectMatchers.dtd" location="$PROJECT_DIR$/resource/system/dtd/GameObjectMatchers.dtd" /> + <resource url="TreasureLists.dtd" location="$PROJECT_DIR$/resource/system/dtd/TreasureLists.dtd" /> + </component> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/out" /> </component> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:40:34
|
Revision: 7887 http://gridarta.svn.sourceforge.net/gridarta/?rev=7887&view=rev Author: akirschbaum Date: 2010-05-22 21:40:28 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix HTML issue. Modified Paths: -------------- trunk/crossfire/resource/HelpFiles/faq.html Modified: trunk/crossfire/resource/HelpFiles/faq.html =================================================================== --- trunk/crossfire/resource/HelpFiles/faq.html 2010-05-22 21:39:26 UTC (rev 7886) +++ trunk/crossfire/resource/HelpFiles/faq.html 2010-05-22 21:40:28 UTC (rev 7887) @@ -74,8 +74,8 @@ </P> <P><B>The editor is missing a useful feature. Can you add it?</B></P> -<P>Report it to the feature tracker on the project homepage: <A -href="http://sourceforge.net/tracker/?group_id=166996&atid=841185">.</P> +<P>Report it to the <A +href="http://sourceforge.net/tracker/?group_id=166996&atid=841185">feature tracker on the project homepage</A>.</P> </BODY> </HTML> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:39:32
|
Revision: 7886 http://gridarta.svn.sourceforge.net/gridarta/?rev=7886&view=rev Author: akirschbaum Date: 2010-05-22 21:39:26 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix HTML issues. Modified Paths: -------------- trunk/crossfire/resource/HelpFiles/guide.html trunk/crossfire/resource/HelpFiles/map_otcs.html trunk/crossfire/resource/HelpFiles/tut_loading.html Modified: trunk/crossfire/resource/HelpFiles/guide.html =================================================================== --- trunk/crossfire/resource/HelpFiles/guide.html 2010-05-22 21:26:41 UTC (rev 7885) +++ trunk/crossfire/resource/HelpFiles/guide.html 2010-05-22 21:39:26 UTC (rev 7886) @@ -33,7 +33,7 @@ should keep the following "golden rules" in your mind. Actually it's more guidelines than rules. However, if you've played Crossfire for a while, I bet you'll find them quite reasonable anyways. -</tr></td></table> +</td></tr></table> <H2 align=center>Guidelines for map-layout and -concept:</H2> <UL> Modified: trunk/crossfire/resource/HelpFiles/map_otcs.html =================================================================== --- trunk/crossfire/resource/HelpFiles/map_otcs.html 2010-05-22 21:26:41 UTC (rev 7885) +++ trunk/crossfire/resource/HelpFiles/map_otcs.html 2010-05-22 21:39:26 UTC (rev 7886) @@ -59,7 +59,7 @@ various <?> buttons offer explanations for each attribute.<br> <P> <IMG SRC="attrib_window.jpg" WIDTH="298" HEIGHT="352" ALIGN="CENTER"> -</LI></P> +</P> </ol> Apart from that, I recommend you to look at existing maps. Look how it's done, copy and experiment... Modified: trunk/crossfire/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/crossfire/resource/HelpFiles/tut_loading.html 2010-05-22 21:26:41 UTC (rev 7885) +++ trunk/crossfire/resource/HelpFiles/tut_loading.html 2010-05-22 21:39:26 UTC (rev 7886) @@ -77,7 +77,7 @@ <P>Like the archetypes, you can get the maps either directly from SVN or download the package. See <A -href="http://sourceforge.net/projects/crossfire/"http://sourceforge.net/projects/crossfire/</A>. +href="http://sourceforge.net/projects/crossfire/">http://sourceforge.net/projects/crossfire/</A>. Don't forget to set the default map path to your local map directory (menu "File->Options...").</P> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |