From: <aki...@us...> - 2008-07-17 18:03:41
|
Revision: 4350 http://gridarta.svn.sourceforge.net/gridarta/?rev=4350&view=rev Author: akirschbaum Date: 2008-07-17 18:03:21 +0000 (Thu, 17 Jul 2008) Log Message: ----------- Fix incorrect time in 'Arch loading took ... Seconds' message. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-17 18:00:55 UTC (rev 4349) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-17 18:03:21 UTC (rev 4350) @@ -307,6 +307,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -324,12 +325,6 @@ final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent")); getMapManager().setRecentManager(recentManager); - final long timeStart = System.currentTimeMillis(); - if (log.isInfoEnabled()) { - log.info("Start to load archetypes..."); - } - mainView.getStatusBar().setStatusText("Loading Archetypes..."); - // browse arch archive // load object from a arch file you found @@ -353,10 +348,6 @@ if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { - if (log.isInfoEnabled()) { - log.info("Arch loading took " + (System.currentTimeMillis() - timeStart) / 1000.0 + " Seconds"); - } - pickmapChooserControl.loadPickmaps(); if (!pickmapChooserControl.isEmpty()) { objectChooser.movePickmapChooserToFront(); Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-17 18:00:55 UTC (rev 4349) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-17 18:03:21 UTC (rev 4350) @@ -102,6 +102,11 @@ /** {@inheritDoc} */ public void loadArchetypes(@NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + final long timeStart = System.currentTimeMillis(); + if (log.isInfoEnabled()) { + log.info("Start to load archetypes..."); + } + setLoadStatus(LoadStatus.LOADING); // status: loading final List<GameObject> invObjects = new ArrayList<GameObject>(); @@ -127,6 +132,10 @@ } else { setLoadStatus(LoadStatus.COMPLETE); // status: stack completed } + + if (log.isInfoEnabled()) { + log.info("Archetype loading took " + (System.currentTimeMillis() - timeStart) / 1000.0 + " seconds."); + } } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-17 18:00:55 UTC (rev 4349) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-17 18:03:21 UTC (rev 4350) @@ -361,6 +361,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, typeList, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -402,12 +403,6 @@ final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent")); getMapManager().setRecentManager(recentManager); - final long timeStart = System.currentTimeMillis(); - if (log.isInfoEnabled()) { - log.info("Start to load archetypes..."); - } - mainView.getStatusBar().setStatusText("Loading Archetypes..."); - // browse arch archive // load object from a arch file you found @@ -423,10 +418,6 @@ if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { - if (log.isInfoEnabled()) { - log.info("Arch loading took " + (System.currentTimeMillis() - timeStart) / 1000.0 + " Seconds"); - } - pickmapChooserControl.loadPickmaps(); if (!pickmapChooserControl.isEmpty()) { objectChooser.movePickmapChooserToFront(); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-17 18:00:55 UTC (rev 4349) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-17 18:03:21 UTC (rev 4350) @@ -141,6 +141,11 @@ /** {@inheritDoc} */ public void loadArchetypes(@NotNull final AbstractArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + final long timeStart = System.currentTimeMillis(); + if (log.isInfoEnabled()) { + log.info("Start to load archetypes..."); + } + setLoadStatus(LoadStatus.LOADING); // status: loading final List<GameObject> invObjects = new ArrayList<GameObject>(); @@ -172,6 +177,10 @@ } else { setLoadStatus(LoadStatus.COMPLETE); // status: stack completed } + + if (log.isInfoEnabled()) { + log.info("Archetype loading took " + (System.currentTimeMillis() - timeStart) / 1000.0 + " seconds."); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-18 21:25:47
|
Revision: 4351 http://gridarta.svn.sourceforge.net/gridarta/?rev=4351&view=rev Author: akirschbaum Date: 2008-07-18 21:25:51 +0000 (Fri, 18 Jul 2008) Log Message: ----------- Add more options to deletion tool. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/MapSquare.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -76,6 +76,7 @@ import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -279,6 +280,14 @@ log.error("Cannot read GameObjectMatchers.xml: " + ex.getMessage()); } GameObjectMatchersInstance.setInstance(gameObjectMatchers); + final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("floor"); + final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("wall"); + final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); + if (monsterMatcher == null) { + log.fatal("GameObjectMatcher 'monster' does not exist"); + throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); + } + DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); if (exitMatcher == null) { log.fatal("GameObjectMatcher 'exit' does not exist"); @@ -296,11 +305,6 @@ AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox()); // Initialize the main view - final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); - if (monsterMatcher == null) { - log.fatal("GameObjectMatcher 'monster' does not exist"); - throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); - } final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); mainView.init(gameObjectAttributesPanel, selectedSquareView, typeList, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -83,6 +83,7 @@ import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -335,6 +336,14 @@ log.error("Cannot read GameObjectMatchers.xml: " + ex.getMessage()); } GameObjectMatchersInstance.setInstance(gameObjectMatchers); + final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("floor"); + final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("wall"); + final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); + if (monsterMatcher == null) { + log.fatal("GameObjectMatcher 'monster' does not exist"); + throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); + } + DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); if (exitMatcher == null) { log.fatal("GameObjectMatcher 'exit' does not exist"); @@ -351,11 +360,6 @@ AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox()); // Initialize the main view - final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcher("monster"); - if (monsterMatcher == null) { - log.fatal("GameObjectMatcher 'monster' does not exist"); - throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); - } final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER); final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); mainView.init(gameObjectAttributesPanel, selectedSquareView, typeList, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -142,6 +142,15 @@ pickmapChooserControl.setPickmapFoldersMenu(folderMenu); } + /** + * Returns whether a given game object matches the selection. + * @param gameObject the game object to check + * @return whether the game object matches + */ + public boolean isMatching(final G gameObject) { + return isPickmapActive() ? pickmapChooserControl.isMatching(gameObject) : archetypeChooserControl.isMatching(gameObject); + } + /** {@inheritDoc} */ @Nullable public G insertSelectedObject(@NotNull final MapControl<G, A, R, V> mapControl, @NotNull final Point pos, final boolean allowMany) { Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -108,4 +108,11 @@ */ void setPickmapFoldersMenu(@Nullable JMenu folderMenu); + /** + * Returns whether the current selection matches a given game object. + * @param gameObject the game object to match + * @return whether the game object matches the selection + */ + boolean isMatching(final G gameObject); + } // interface ObjectChooser Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -334,4 +334,14 @@ return selectedPanel == panel; } + /** + * Returns whether the selected archetype matches a given game object. + * @param gameObject the game object to match + * @return whether the selected archetype matches; returns + * <code>false</code> if no archetype is selected + */ + public boolean isMatching(final G gameObject) { + return gameObject.getArchetype() == selectedArch; + } + } // class ArchetypeChooserControl Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -20,11 +20,20 @@ package net.sf.gridarta.gui.map.tools; import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.Point; +import java.util.HashSet; +import java.util.Set; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JPanel; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; @@ -50,21 +59,141 @@ @NotNull private final MainControl<G, ?, ?, ?> mainControl; - /** The ToggleAction for toggling the deleteBelow status. */ - private final ToggleAction deleteBelowAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "deleteBelow", this); + /** + * A {@link GameObjectMatcher} matching floor game objects. + */ + @Nullable + private static GameObjectMatcher floorGameObjectMatcher = null; - /** The position for deletion. */ - private boolean deleteBelow; + /** + * A {@link GameObjectMatcher} matching wall game objects. + */ + @Nullable + private static GameObjectMatcher wallGameObjectMatcher = null; /** + * A {@link GameObjectMatcher} matching monster game objects. + */ + @Nullable + private static GameObjectMatcher monsterGameObjectMatcher = null; + + /** + * The {@link ObjectChooser} to use. + */ + @NotNull + private final ObjectChooser<G, A, R, V> objectChooser; + + /** + * The action for "ignore walls". + */ + private final ToggleAction ignoreWallsAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "deletionToolExceptionsIgnoreWalls", this); + + /** + * The action for "ignore floors". + */ + private final ToggleAction ignoreFloorsAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "deletionToolExceptionsIgnoreFloors", this); + + /** + * The action for "ignore monsters". + */ + private final ToggleAction ignoreMonstersAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "deletionToolExceptionsIgnoreMonsters", this); + + /** + * Whener "ignore walls" is enabled. + */ + private boolean deletionToolExceptionsIgnoreWalls; + + /** + * Whener "ignore floors" is enabled. + */ + private boolean deletionToolExceptionsIgnoreFloors; + + /** + * Whener "ignore monsters" is enabled. + */ + private boolean deletionToolExceptionsIgnoreMonsters; + + /** + * The {@link JComboBox} for selecting the objects to delete. + */ + private final JComboBox deleteComboBox; + + /** + * The {@link JComboBox} for selecting the scope to delete. + */ + private final JComboBox scopeComboBox; + + /** + * Index into {@link #deleteComboBox}: delete topmost object. + */ + private static final int DELETE_TOPMOST = 0; + + /** + * Index into {@link #deleteComboBox}: delete all objects. + */ + private static final int DELETE_ALL = 1; + + /** + * Index into {@link #deleteComboBox}: delete bottommost object. + */ + private static final int DELETE_BOTTOMMOST = 2; + + /** + * Index into {@link #scopeComboBox}: delete all objects. + */ + private static final int SCOPE_TILE = 0; + + /** + * Index into {@link #scopeComboBox}: delete all objects above floors. + */ + private static final int SCOPE_ABOVE_FLOOR = 1; + + /** + * Index into {@link #scopeComboBox}: delete all objects below floors. + */ + private static final int SCOPE_BELOW_FLOOR = 2; + + /** + * Index into {@link #scopeComboBox}: delete all objects matching the + * object chooser. + */ + private static final int SCOPE_SELECTED_OBJECT = 3; + + /** + * Index into {@link #scopeComboBox}: delete all wall objects. + */ + private static final int SCOPE_WALL = 4; + + /** + * Index into {@link #scopeComboBox}: delete all floor objects. + */ + private static final int SCOPE_FLOOR = 5; + + /** * Create a DeletionTool. * @param mainControl the main control + * @param objectChooser the object chooser to use */ - public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl) { + public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { super("deletion"); this.mainControl = mainControl; + this.objectChooser = objectChooser; + deleteComboBox = createDeleteComboBox(); + scopeComboBox = createScopeComboBox(); } + /** + * Initializes the class. + * @param floorGameObjectMatcher the floor matcher to use + * @param wallGameObjectMatcher the wall matcher to use + * @param monsterGameObjectMatcher the monster matcher to use + */ + public static void init(@Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher) { + DeletionTool.floorGameObjectMatcher = floorGameObjectMatcher; + DeletionTool.wallGameObjectMatcher = wallGameObjectMatcher; + DeletionTool.monsterGameObjectMatcher = monsterGameObjectMatcher; + } + /** {@inheritDoc} */ @Override public void pressed(final MouseOpEvent<G, A, R, V> e) { @@ -96,17 +225,111 @@ * @param mapControl map control of map to delete arch from */ private void deleteArch(final Point mapLoc, final MapControl<G, A, R, V> mapControl) { - G delArch = null; final MapSquare<G, A, R> mapSquare = mapControl.getMapModel().getMapSquare(mapLoc); - for (final G searchArch : deleteBelow ? mapSquare : mapSquare.reverse()) { - if (mainControl.isEditType(searchArch)) { - delArch = searchArch.getHead(); - break; + final int scopeType = scopeComboBox.getSelectedIndex(); + final int deleteType = deleteComboBox.getSelectedIndex(); + + @Nullable final G start; + @Nullable final G end; + switch (scopeType) { + case SCOPE_TILE: + start = mapSquare.getFirst(); + end = mapSquare.getLast(); + break; + + case SCOPE_ABOVE_FLOOR: + start = floorGameObjectMatcher == null ? null : mapSquare.getAfterLast(floorGameObjectMatcher); + end = mapSquare.getLast(); + break; + + case SCOPE_BELOW_FLOOR: + start = mapSquare.getFirst(); + end = floorGameObjectMatcher == null ? null : mapSquare.getBeforeFirst(floorGameObjectMatcher); + break; + + case SCOPE_SELECTED_OBJECT: + start = mapSquare.getFirst(); + end = mapSquare.getLast(); + break; + + case SCOPE_WALL: + start = mapSquare.getFirst(); + end = mapSquare.getLast(); + break; + + case SCOPE_FLOOR: + start = mapSquare.getFirst(); + end = mapSquare.getLast(); + break; + + default: + return; + } + if (start == null || end == null) { + return; + } + final Set<G> gameObjectsToDelete = new HashSet<G>(); + boolean foundFirst = false; + final G start2 = deleteType == DELETE_TOPMOST ? end : start; + final G end2 = deleteType == DELETE_TOPMOST ? start : end; + for (final G gameObject : deleteType == DELETE_TOPMOST ? mapSquare.reverse() : mapSquare) { + if (gameObject == start2) { + foundFirst = true; } + if (foundFirst) { + final G head = gameObject.getHead(); + if (mainControl.isEditType(head)) { + boolean insert = false; + switch (scopeType) { + case SCOPE_TILE: + case SCOPE_ABOVE_FLOOR: + case SCOPE_BELOW_FLOOR: + insert = true; + break; + + case SCOPE_SELECTED_OBJECT: + if (objectChooser.isMatching(head)) { + insert = true; + } + break; + + case SCOPE_WALL: + if (wallGameObjectMatcher != null && wallGameObjectMatcher.isMatching(head)) { + insert = true; + } + break; + + case SCOPE_FLOOR: + if (floorGameObjectMatcher != null && floorGameObjectMatcher.isMatching(head)) { + insert = true; + } + break; + } + if (insert) { + if (deletionToolExceptionsIgnoreWalls && wallGameObjectMatcher != null && wallGameObjectMatcher.isMatching(head)) { + // ignore + } else if (deletionToolExceptionsIgnoreFloors && floorGameObjectMatcher != null && floorGameObjectMatcher.isMatching(head)) { + // ignore + } else if (deletionToolExceptionsIgnoreMonsters && monsterGameObjectMatcher != null && monsterGameObjectMatcher.isMatching(head)) { + // ignore + } else { + gameObjectsToDelete.add(head); + if (deleteType != DELETE_ALL) { + break; + } + } + } + } + if (gameObject == end2) { + break; + } + } } - if (delArch != null) { + if (!gameObjectsToDelete.isEmpty()) { mapSquare.getModel().beginTransaction("Delete Object"); - mapSquare.getModel().deleteMapArch(delArch, true); + for (final G gameObjectToDelete : gameObjectsToDelete) { + mapSquare.getModel().deleteMapArch(gameObjectToDelete, true); + } mapSquare.getModel().endTransaction(); } } @@ -115,25 +338,125 @@ @Override @Nullable public Component createOptionsView() { - final JPanel optionsPanel = new JPanel(); - optionsPanel.add(deleteBelowAction.createCheckBox()); - return optionsPanel; + final JPanel panel = new JPanel(); + panel.setLayout(new GridBagLayout()); + + final GridBagConstraints gbcLabel = new GridBagConstraints(); + gbcLabel.anchor = GridBagConstraints.EAST; + + final GridBagConstraints gbcComboBox = new GridBagConstraints(); + gbcComboBox.fill = GridBagConstraints.HORIZONTAL; + gbcComboBox.weightx = 1; + gbcComboBox.gridwidth = GridBagConstraints.REMAINDER; + + final GridBagConstraints gbcCheckBox = new GridBagConstraints(); + gbcCheckBox.fill = GridBagConstraints.HORIZONTAL; + gbcCheckBox.gridwidth = GridBagConstraints.REMAINDER; + + panel.add(createLabel("deletionTool.delete", deleteComboBox), gbcLabel); + panel.add(deleteComboBox, gbcComboBox); + + panel.add(createLabel("deletionTool.scope", scopeComboBox), gbcLabel); + panel.add(scopeComboBox, gbcComboBox); + + panel.add(ignoreWallsAction.createCheckBox(), gbcCheckBox); + panel.add(ignoreFloorsAction.createCheckBox(), gbcCheckBox); + panel.add(ignoreMonstersAction.createCheckBox(), gbcCheckBox); + return panel; } /** - * Returns the position for deletion. - * @return the position for deletion. + * Create a {@link JComboBox} for selecting the objects to delete. + * @return the combo box */ - public boolean isDeleteBelow() { - return deleteBelow; + private static JComboBox createDeleteComboBox() { + final String[] options = new String[] { + ACTION_FACTORY.getString("deletionTool.delete.top"), + ACTION_FACTORY.getString("deletionTool.delete.all"), + ACTION_FACTORY.getString("deletionTool.delete.bottom"), + }; + final JComboBox comboBox = new JComboBox(options); + comboBox.setToolTipText(ACTION_FACTORY.getString("deletionTool.delete.shortdescription")); + return comboBox; } /** - * Sets the position for deletion. - * @param deleteBelow the position for deletion. + * Create a {@link JComboBox} for selecting the scope to delete. + * @return the combo box */ - public void setDeleteBelow(final boolean deleteBelow) { - this.deleteBelow = deleteBelow; + private static JComboBox createScopeComboBox() { + final String[] options = new String[] { + ACTION_FACTORY.getString("deletionTool.scope.tile"), + ACTION_FACTORY.getString("deletionTool.scope.aboveFloor"), + ACTION_FACTORY.getString("deletionTool.scope.belowFloor"), + ACTION_FACTORY.getString("deletionTool.scope.selectedObject"), + ACTION_FACTORY.getString("deletionTool.scope.wall"), + ACTION_FACTORY.getString("deletionTool.scope.floor"), + }; + final JComboBox comboBox = new JComboBox(options); + comboBox.setToolTipText(ACTION_FACTORY.getString("deletionTool.scope.shortdescription")); + return comboBox; } + /** + * Create a {@link JLabel} instance. + * @return the label + */ + private static JLabel createLabel(final String key, final JComponent component) { + final JLabel label = ACTION_FACTORY.createLabel(component, key + ".text"); + label.setToolTipText(ACTION_FACTORY.getString(key + ".shortdescription")); + return label; + } + + /** + * Returns whether walls should not be deleted. + * @return whether walls should not be deleted + */ + public boolean isDeletionToolExceptionsIgnoreWalls() { + return deletionToolExceptionsIgnoreWalls; + } + + /** + * Sets whether walls should not be deleted. + * @param deletionToolExceptionsIgnoreWalls whether walls should not be + * deleted + */ + public void setDeletionToolExceptionsIgnoreWalls(final boolean deletionToolExceptionsIgnoreWalls) { + this.deletionToolExceptionsIgnoreWalls = deletionToolExceptionsIgnoreWalls; + } + + /** + * Returns whether floors should not be deleted. + * @return whether floors should not be deleted + */ + public boolean isDeletionToolExceptionsIgnoreFloors() { + return deletionToolExceptionsIgnoreFloors; + } + + /** + * Sets whether floors should not be deleted. + * @param deletionToolExceptionsIgnoreFloors whether floors should not be + * deleted + */ + public void setDeletionToolExceptionsIgnoreFloors(final boolean deletionToolExceptionsIgnoreFloors) { + this.deletionToolExceptionsIgnoreFloors = deletionToolExceptionsIgnoreFloors; + } + + /** + * Returns whether monsters should not be deleted. + * @return whether monsters should not be deleted + */ + public boolean isDeletionToolExceptionsIgnoreMonsters() { + return deletionToolExceptionsIgnoreMonsters; + } + + /** + * Sets whether monsters should not be deleted. + * @param deletionToolExceptionsIgnoreMonsters whether monsters should not + * be deleted + */ + public void setDeletionToolExceptionsIgnoreMonsters(final boolean deletionToolExceptionsIgnoreMonsters) { + this.deletionToolExceptionsIgnoreMonsters = deletionToolExceptionsIgnoreMonsters; + } + } // class DeletionTool Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -93,7 +93,7 @@ */ public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { createUI(); - for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser)}) { + for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl, objectChooser), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-18 21:25:51 UTC (rev 4351) @@ -20,14 +20,35 @@ selection.icon=misc/Select16 selection.shortdescription=Select regions of the map. deletion.icon=misc/Delete16 -deletion.shortdescription=Delete topmost or bottommost objects. +deletion.shortdescription=Delete objects. insertion.icon=misc/Insert16 insertion.shortdescription=Insert topmost objects. void.icon=misc/Void16 void.shortdescription=Do nothing (makes selected mouse button inactive). -deleteBelow.text=Delete below insertBelow.text=Insert below left=left middle=middle right=right mouse=Mousebutton + +deletionTool.delete.text=Delete: +deletionTool.delete.shortdescription=<html>Selects the objects to delete:<br>topmost object=only the topmost object in scope<br>all=all objects in scope<br>bottommost object=only the bottommost object in scope +deletionTool.delete.top=topmost object +deletionTool.delete.all=all objects +deletionTool.delete.bottom=bottommost object + +deletionTool.scope.text=Scope: +deletionTool.scope.shortdescription=<html>Selects the scope to delete:<br>tile=all objects in the tile<br>above floor=only objects above floor objects<br>below floor=only objects below floor objects<br>selected object=objects matching the Object Chooser's selection<br>wall=all wall objects<br>floor=all floor objects +deletionTool.scope.tile=tile +deletionTool.scope.aboveFloor=above floor +deletionTool.scope.belowFloor=below floor +deletionTool.scope.selectedObject=selected object +deletionTool.scope.wall=wall +deletionTool.scope.floor=floor + +deletionToolExceptionsIgnoreWalls.text=ignore walls +deletionToolExceptionsIgnoreWalls.shortdescription=Prevents walls from being deleted. +deletionToolExceptionsIgnoreFloors.text=ignore floors +deletionToolExceptionsIgnoreFloors.shortdescription=Prevents floors from being deleted. +deletionToolExceptionsIgnoreMonsters.text=ignore monsters +deletionToolExceptionsIgnoreMonsters.shortdescription=Prevents monsters from being deleted. Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-18 21:25:51 UTC (rev 4351) @@ -18,12 +18,33 @@ # selection.shortdescription=Kartenbereich ausw\xE4hlen. -deletion.shortdescription=L\xF6schen des obersten oder untersten Objekts. +deletion.shortdescription=L\xF6schen von Objekten. insertion.shortdescription=Objekte oben einf\xFCgen. void.shortdescription=Nichts (deaktiviert die Maustaste). -deleteBelow.text=Unten l\xF6schen insertBelow.text=Oben l\xF6schen left=links middle=mitte right=rechts mouse=Maustaste + +deletionTool.delete.text=L\xF6schen: +deletionTool.delete.shortdescription=<html>W\xE4hlt die zu l\xF6schenden Objekte:<br>oberstes Objekt=nur das oberste Objekt im Bereich<br>alle=alle Objekte im Bereich<br>unterstes Objekt=nur das unterste Objekt im Bereich +deletionTool.delete.top=oberstes Objekt +deletionTool.delete.all=alle Objekte +deletionTool.delete.bottom=oberstes Objekt + +deletionTool.scope.text=Bereich:: +deletionTool.scope.shortdescription=<html>W\xE4hlt den zu l\xF6schenden Bereich:<br>Feld=alle Objekte im Feld<br>\xFCber Boden=alle Objekt \xFCber dem Boden<br>unter Boden=alle Objekte unter dem Boden<br>ausgew\xE4hltes Objekt=Ausgew\xE4hl im Object Chooser<br>Wand=alle Wand-Objekte<br>Boden=alle Boden-Objekte +deletionTool.scope.tile=Feld +deletionTool.scope.aboveFloor=\xFCber Boden +deletionTool.scope.belowFloor=unter Boden +deletionTool.scope.selectedObject=ausgew\xE4hltes Objekt +deletionTool.scope.wall=Wand +deletionTool.scope.floor=Boden + +deletionToolExceptionsIgnoreWalls.text=Wand ignorieren +deletionToolExceptionsIgnoreWalls.shortdescription=Verhindert das L\xF6schen von W\xE4nden. +deletionToolExceptionsIgnoreFloors.text=Boden ignorieren +deletionToolExceptionsIgnoreFloors.shortdescription=Verhindert das L\xF6schen vom Boden. +deletionToolExceptionsIgnoreMonsters.text=Monster ignorieren +deletionToolExceptionsIgnoreMonsters.shortdescription=Verhindert das L\xF6schen von Monstern. Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-18 21:25:51 UTC (rev 4351) @@ -21,9 +21,30 @@ #deletion.shortdescription= #insertion.shortdescription= #void.shortdescription= -#deleteBelow.text= #insertBelow.text= #left= #middle= #right= #mouse= + +#deletionTool.delete.text= +#deletionTool.delete.shortdescription= +#deletionTool.delete.top= +#deletionTool.delete.all= +#deletionTool.delete.bottom= + +#deletionTool.scope.text= +#deletionTool.scope.shortdescription= +#deletionTool.scope.tile= +#deletionTool.scope.aboveFloor= +#deletionTool.scope.belowFloor= +#deletionTool.scope.selectedObject= +#deletionTool.scope.wall= +#deletionTool.scope.floor= + +#deletionToolExceptionsIgnoreWalls.text= +#deletionToolExceptionsIgnoreWalls.shortdescription= +#deletionToolExceptionsIgnoreFloors.text= +#deletionToolExceptionsIgnoreFloors.shortdescription= +#deletionToolExceptionsIgnoreMonsters.text= +#deletionToolExceptionsIgnoreMonsters.shortdescription= Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-18 21:25:51 UTC (rev 4351) @@ -21,9 +21,30 @@ #deletion.shortdescription= #insertion.shortdescription= #void.shortdescription= -#deleteBelow.text= #insertBelow.text= #left= #middle= #right= #mouse= + +#deletionTool.delete.text= +#deletionTool.delete.shortdescription= +#deletionTool.delete.top= +#deletionTool.delete.all= +#deletionTool.delete.bottom= + +#deletionTool.scope.text= +#deletionTool.scope.shortdescription= +#deletionTool.scope.tile= +#deletionTool.scope.aboveFloor= +#deletionTool.scope.belowFloor= +#deletionTool.scope.selectedObject= +#deletionTool.scope.wall= +#deletionTool.scope.floor= + +#deletionToolExceptionsIgnoreWalls.text= +#deletionToolExceptionsIgnoreWalls.shortdescription= +#deletionToolExceptionsIgnoreFloors.text= +#deletionToolExceptionsIgnoreFloors.shortdescription= +#deletionToolExceptionsIgnoreMonsters.text= +#deletionToolExceptionsIgnoreMonsters.shortdescription= Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -382,4 +382,15 @@ return view.isEmpty(); } + /** + * Returns whether the current selection matches a given game object. + * @param gameObject the game object to match + * @return whether the selection matches; returns <code>false</code> if no + * selection exists + */ + public boolean isMatching(final G gameObject) { + final G selection = getSelection(); + return selection != null && gameObject.isEqual(selection); + } + } // class PickmapChooserControl Modified: trunk/src/app/net/sf/gridarta/map/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-17 18:03:21 UTC (rev 4350) +++ trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-18 21:25:51 UTC (rev 4351) @@ -22,7 +22,9 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.GameObjectContainer; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A single Map Square. This class is implemented in a way that changes via some @@ -114,4 +116,41 @@ return mapSquare.model == model && mapSquare.mapX == mapX && mapSquare.mapY == mapY; } + /** + * Returns the game object after the last occurrence of a matching game + * object. + * @param gameObjectMatcher the matcher to use + * @return the game object after the last match, or <code>null</code> if no + * such game object exists + */ + @Nullable + public G getAfterLast(@NotNull final GameObjectMatcher gameObjectMatcher) { + G prev = null; + for (final G gameObject : reverse()) { + if (gameObjectMatcher.isMatching(gameObject)) { + return prev; + } + prev = gameObject; + } + return null; + } + + /** + * Returns the game object before the first occurrence of a matching game + * object. + * @param gameObjectMatcher the matcher to use + * @return the game object before the first match, or <code>null</code> if + * no such game object exists + */ + @Nullable + public G getBeforeFirst(@NotNull final GameObjectMatcher gameObjectMatcher) { + G prev = null; + for (final G gameObject : this) { + if (gameObjectMatcher.isMatching(gameObject)) { + return prev; + } + prev = gameObject; + } + return null; + } } // class MapSquare This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-19 07:06:56
|
Revision: 4354 http://gridarta.svn.sourceforge.net/gridarta/?rev=4354&view=rev Author: akirschbaum Date: 2008-07-19 07:07:05 +0000 (Sat, 19 Jul 2008) Log Message: ----------- Add missing ChangeLog entry. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-19 07:06:20 UTC (rev 4353) +++ trunk/crossfire/ChangeLog 2008-07-19 07:07:05 UTC (rev 4354) @@ -1,3 +1,7 @@ +2008-07-18 Andreas Kirschbaum + + * Add more options to deletion tool. + 2008-07-15 Andreas Kirschbaum * Add tool selector. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-07-19 07:06:20 UTC (rev 4353) +++ trunk/daimonin/ChangeLog 2008-07-19 07:07:05 UTC (rev 4354) @@ -1,3 +1,7 @@ +2008-07-18 Andreas Kirschbaum + + * Add more options to deletion tool. + 2008-06-26 Andreas Kirschbaum * Set difficulty=1 in newly created pickmaps. This circumvents an This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-21 07:18:04
|
Revision: 4359 http://gridarta.svn.sourceforge.net/gridarta/?rev=4359&view=rev Author: akirschbaum Date: 2008-07-21 07:15:31 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Fix Archetype Chooser text resources. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -379,11 +379,6 @@ moveTileBottom.shortdescription=Move Object to bottom of Square -#################### -# Archetype Chooser -editPopup.text=Edit Archetype - - ########## # Plugins Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -341,11 +341,6 @@ moveTileBottom.shortdescription=Object ans Ende verschieben -#################### -# Archetype Chooser -editPopup.text=Archetyp bearbeiten - - ########## # Plugins Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -342,11 +342,6 @@ #moveTileBottom.shortdescription= -#################### -# Archetype Chooser -#editPopup.text= - - ########## # Plugins Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -340,11 +340,6 @@ #moveTileBottom.shortdescription= -#################### -# Archetype Chooser -#editPopup.text= - - ########## # Plugins Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/daimonin/src/daieditor/messages.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -441,11 +441,6 @@ Validator.TilePaths.msg=<html><h3>{0}</h3><p>This map has invalid tile paths.<br>Go to the map properties dialog and change the map tile paths. -#################### -# Archetype Chooser -editPopup.text=Edit Archetype - - ####################### # Various Log Messages logExitWithExit=Exiting with System.exit(). Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -401,8 +401,3 @@ #Validator.TilePaths.title= #Validator.TilePaths.msg= - - -#################### -# Archetype Chooser -editPopup.text=Archetyp bearbeiten Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -395,8 +395,3 @@ #Validator.TilePaths.title= #Validator.TilePaths.msg= - - -#################### -# Archetype Chooser -#editPopup.text= Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -396,8 +396,3 @@ #Validator.TilePaths.title= #Validator.TilePaths.msg= - - -#################### -# Archetype Chooser -#editPopup.text= Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-07-21 07:15:31 UTC (rev 4359) @@ -58,7 +58,7 @@ private static final long serialVersionUID = 1L; /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); /** The popup menu for the arch lists to bring up the editor. */ // This looks unused, but don't remove it. It will be used in future. Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -978,3 +978,8 @@ # Object Chooser objectChooser.archetypesTabTitle=Archetypes objectChooser.pickmapsTabTitle=Pickmaps + + +#################### +# Archetype Chooser +editPopup.text=Edit Archetype Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -840,3 +840,8 @@ # Object Chooser objectChooser.archetypesTabTitle=Archetypen objectChooser.pickmapsTabTitle=Pickmaps + + +#################### +# Archetype Chooser +editPopup.text=Archetyp bearbeiten Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -839,3 +839,8 @@ # Object Chooser objectChooser.archetypesTabTitle=Arches #objectChooser.pickmapsTabTitle= + + +#################### +# Archetype Chooser +#editPopup.text= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-07-19 10:40:09 UTC (rev 4358) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-07-21 07:15:31 UTC (rev 4359) @@ -843,3 +843,8 @@ # Object Chooser #objectChooser.archetypesTabTitle= #objectChooser.pickmapsTabTitle= + + +#################### +# Archetype Chooser +#editPopup.text= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-21 18:06:57
|
Revision: 4366 http://gridarta.svn.sourceforge.net/gridarta/?rev=4366&view=rev Author: akirschbaum Date: 2008-07-21 18:07:02 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-21 18:02:26 UTC (rev 4365) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-21 18:07:02 UTC (rev 4366) @@ -245,7 +245,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, mapManager, pickmapChooserControl); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-21 18:02:26 UTC (rev 4365) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-21 18:07:02 UTC (rev 4366) @@ -298,7 +298,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, mapManager, pickmapChooserControl); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-21 18:02:26 UTC (rev 4365) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-21 18:07:02 UTC (rev 4366) @@ -28,7 +28,6 @@ import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -94,7 +93,7 @@ * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control */ - public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-21 18:41:57
|
Revision: 4373 http://gridarta.svn.sourceforge.net/gridarta/?rev=4373&view=rev Author: akirschbaum Date: 2008-07-21 18:42:01 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Remove unused type parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -855,7 +855,7 @@ } /** {@inheritDoc} */ - public ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> getObjectChooser() { + public ObjectChooser<GameObject, MapArchObject, Archetype> getObjectChooser() { return objectChooser; } Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -70,7 +70,7 @@ private FaceObjects faceObjects = null; /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser = null; + private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull @@ -147,7 +147,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -1022,7 +1022,7 @@ } /** {@inheritDoc} */ - public ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> getObjectChooser() { + public ObjectChooser<GameObject, MapArchObject, Archetype> getObjectChooser() { return objectChooser; } Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -70,7 +70,7 @@ private FaceObjects faceObjects = null; /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser = null; + private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull @@ -149,7 +149,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -140,6 +140,6 @@ * @param pickmapChooserControl the pickmap chooser control instance * @param selectedSquareView the selected square view instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R, V> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -282,7 +282,7 @@ * Return the insertion object chooser. * @return the insertion object chooser */ - ObjectChooser<G, A, R, V> getObjectChooser(); + ObjectChooser<G, A, R> getObjectChooser(); /** * Returns the main actions. Modified: trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -33,7 +33,7 @@ public final class ArchNPickChangeListener implements ChangeListener { /** The Object Chooser to inform about changes. */ - private final ObjectChooser<?, ?, ?, ?> objectChooser; + private final ObjectChooser<?, ?, ?> objectChooser; private final JTabbedPane tabpane; // parent pane for archlist & pickmaps @@ -44,7 +44,7 @@ * @param objectChooser The Object Chooser to inform about changes. * @param pane the JTabbedPane containing both archlist and pickmaps */ - public ArchNPickChangeListener(@NotNull final ObjectChooser<?, ?, ?, ?> objectChooser, @NotNull final JTabbedPane pane) { + public ArchNPickChangeListener(@NotNull final ObjectChooser<?, ?, ?> objectChooser, @NotNull final JTabbedPane pane) { this.objectChooser = objectChooser; tabpane = pane; selectedIndex = tabpane.getSelectedIndex(); Modified: trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -67,8 +67,8 @@ * search results in the "find archetypes" dialog. * @param archTypeList the instance for looking up archetype types */ - public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { - final FindArchetypesDialog<G, A, R, V> findArchetypesDialog = new FindArchetypesDialog<G, A, R, V>(parent, archetypeChooserControl, objectChooser, archTypeList); + public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, final CFArchTypeList archTypeList) { + final FindArchetypesDialog<G, A, R> findArchetypesDialog = new FindArchetypesDialog<G, A, R>(parent, archetypeChooserControl, objectChooser, archTypeList); aDisplayObjectNames = (ToggleAction) ACTION_FACTORY.createToggle(true, "displayObjectNames", archetypeChooserControl); ACTION_FACTORY.createAction(true, "findArchetypes", findArchetypesDialog); archetypeChooserControl.addArchetypeChooserListener(archetypeChooserListener); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -47,7 +47,7 @@ * The object Chooser implementation. * @author Andreas Kirschbaum */ -public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel implements ObjectChooser<G, A, R, V> { +public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel implements ObjectChooser<G, A, R> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -82,7 +82,7 @@ /** The ObjectChooser instance to use. */ @NotNull - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; /** Action called for "clear". */ private final Action aClear; @@ -286,7 +286,7 @@ * @param faceObjects the FaceObjects instance to use * @param objectChooser the animation objects instance to use */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { this.mainControl = mainControl; this.pickmapChooserControl = pickmapChooserControl; this.animationObjects = animationObjects; Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -48,7 +48,7 @@ /** The ObjectChooser to use. */ @NotNull - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; private final JLabel archObjNameLabel = new JLabel("Name:"); @@ -66,7 +66,7 @@ private final JLabel archTileText = new JLabel(); - public ObjectChoiceDisplay(final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public ObjectChoiceDisplay(final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser) { this.mainControl = mainControl; this.objectChooser = objectChooser; setLayout(new GridBagLayout()); Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -24,7 +24,6 @@ import javax.swing.JMenu; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; @@ -34,7 +33,7 @@ * Common base interface for ObjectChoosers. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { +public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** * Return if the Pickmap Chooser is active. Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -74,7 +74,7 @@ private final MainControl<G, A, R, V> mainControl; @NotNull - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; private boolean isBuilt = false; @@ -111,7 +111,7 @@ * Construct instance. * @param mainControl MainControl */ - public ReplaceDialog(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public ReplaceDialog(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser) { dialog = createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("replaceTitle")); dialog.setModal(false); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -21,7 +21,7 @@ return instance != null && instance.isBuilt(); } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> ReplaceDialog<G, A, R, V> getInstance(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> ReplaceDialog<G, A, R, V> getInstance(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser) { if (instance == null) { instance = new ReplaceDialog<G, A, R, V>(mainControl, objectChooser); } Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -49,7 +49,6 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -59,7 +58,7 @@ * Dialog used to find archetypes. * @author Andreas Kirschbaum */ -public final class FindArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { +public final class FindArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** Do not perform an auto-search until the input name reaches this length. */ private static final int MINIMUM_AUTOSEARCH_LENGTH = 3; @@ -74,7 +73,7 @@ private final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl; /** The insertion object chooser to use when selecing search results. */ - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; /** The name input field. */ private final JTextField nameField; @@ -132,7 +131,7 @@ * search results.# * @param archTypeList the instance for looking up archetype types */ - public FindArchetypesDialog(final Component parent, final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { + public FindArchetypesDialog(final Component parent, final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, final ObjectChooser<G, A, R> objectChooser, final CFArchTypeList archTypeList) { this.archetypeChooserControl = archetypeChooserControl; this.objectChooser = objectChooser; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -126,7 +126,7 @@ * The {@link ObjectChooser} to use. */ @NotNull - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; /** * The action for "ignore walls". @@ -173,7 +173,7 @@ * @param mainControl the main control * @param objectChooser the object chooser to use */ - public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser) { super("deletion"); this.mainControl = mainControl; this.objectChooser = objectChooser; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -57,7 +57,7 @@ /** The ObjectChooser to use. */ @NotNull - private final ObjectChooser<G, A, R, V> objectChooser; + private final ObjectChooser<G, A, R> objectChooser; /** The position for insertion. */ private boolean insertBelow; @@ -67,7 +67,7 @@ * @param selectedSquareView the selected square view * @param objectChooser the ObjectChooser to use */ - public InsertionTool(@NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public InsertionTool(@NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { super("insertion"); this.selectedSquareView = selectedSquareView; this.objectChooser = objectChooser; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -40,13 +40,13 @@ /** The object chooser to update. */ @NotNull - private final ObjectChooser<G, ?, ?, ?> objectChooser; + private final ObjectChooser<G, ?, ?> objectChooser; /** * Create a BasicAbstractTool. * @param objectChooser the object chooser to update */ - public SelectionTool(@NotNull final ObjectChooser<G, ?, ?, ?> objectChooser) { + public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser) { super("selection"); this.objectChooser = objectChooser; } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -69,7 +69,7 @@ * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use */ - public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { super(new BorderLayout()); lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser); mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-21 18:34:33 UTC (rev 4372) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-21 18:42:01 UTC (rev 4373) @@ -91,7 +91,7 @@ * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R, V> objectChooser) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { createUI(); for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl, objectChooser), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-22 18:45:19
|
Revision: 4386 http://gridarta.svn.sourceforge.net/gridarta/?rev=4386&view=rev Author: akirschbaum Date: 2008-07-22 18:45:23 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Add more options to insertion tool. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/MapImageCache.java trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapModel.java trunk/src/app/net/sf/gridarta/map/MapSquare.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/map/InsertionMode.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/crossfire/ChangeLog 2008-07-22 18:45:23 UTC (rev 4386) @@ -1,3 +1,7 @@ +2008-07-22 Andreas Kirschbaum + + * Add more options to insertion tool. + 2008-07-18 Andreas Kirschbaum * Add more options to deletion tool. Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -88,6 +88,7 @@ import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.validation.DefaultErrorCollector; @@ -287,7 +288,12 @@ log.fatal("GameObjectMatcher 'monster' does not exist"); throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); } + final GameObjectMatcher belowFloorMatcher = gameObjectMatchers.getMatcher("below_floor"); + if (belowFloorMatcher == null) { + log.warn("GameObjectMatcher 'below_floor' does not exist"); + } DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); + InsertionMode.init(floorMatcher, wallMatcher, belowFloorMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); if (exitMatcher == null) { log.fatal("GameObjectMatcher 'exit' does not exist"); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/daimonin/ChangeLog 2008-07-22 18:45:23 UTC (rev 4386) @@ -1,3 +1,7 @@ +2008-07-22 Andreas Kirschbaum + + * Add more options to insertion tool. + 2008-07-18 Andreas Kirschbaum * Add more options to deletion tool. Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -95,6 +95,7 @@ import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; @@ -343,7 +344,12 @@ log.fatal("GameObjectMatcher 'monster' does not exist"); throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); } + final GameObjectMatcher belowFloorMatcher = gameObjectMatchers.getMatcher("below_floor"); + if (belowFloorMatcher == null) { + log.warn("GameObjectMatcher 'below_floor' does not exist"); + } DeletionTool.init(floorMatcher, wallMatcher, monsterMatcher); + InsertionMode.init(floorMatcher, wallMatcher, belowFloorMatcher); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcher("exit"); if (exitMatcher == null) { log.fatal("GameObjectMatcher 'exit' does not exist"); Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -158,7 +159,7 @@ if ((mode == Mode.DO_CUT || mode == Mode.DO_COPY) && gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject)) { // copy this gameObject final G clone = gameObject.createClone(posx - selRec.x, posy - selRec.y); - copyMapCtrl.getMapModel().addGameObjectToMap(clone, false); + copyMapCtrl.getMapModel().addGameObjectToMap(clone, InsertionMode.TOPMOST); } // delete the gameObject if we have a "cut" or "clear" command // again, arches that don't match the view settings are ignored @@ -199,7 +200,7 @@ if (mapControl.getMapModel().isPointValid(pos)) { for (final G gameObject : square) { if (!gameObject.isMulti()) { - mapControl.getMapModel().addCopyToMap(gameObject, pos, true, false); + mapControl.getMapModel().addCopyToMap(gameObject, pos, true, InsertionMode.TOPMOST); } } } @@ -211,7 +212,7 @@ if (mapControl.getMapModel().isPointValid(pos)) { for (final G gameObject : square) { if (gameObject.isMulti()) { - mapControl.getMapModel().addCopyToMap(gameObject, pos, true, false); + mapControl.getMapModel().addCopyToMap(gameObject, pos, true, InsertionMode.TOPMOST); } } } @@ -222,13 +223,12 @@ /** * Executing the Fill command. * @param mapView the map view to fill on - * @param fillBelow if true, the filling content is placed *below* the - * existing map + * @param insertionMode the insertion mode to use * @param seed map view of the random objects or <code>null</code> to use * the currently selected Archetype. * @param density the fill density in percent; -1 to disable */ - public void fill(final MapView<G, A, R, V> mapView, final boolean fillBelow, final MapView<G, A, R, V> seed, final int density) { + public void fill(final MapView<G, A, R, V> mapView, final InsertionMode insertionMode, final MapView<G, A, R, V> seed, final int density) { if (mapView.getView().getMapGrid().getSelectedRec() == null) { return; // should actually never happen } @@ -249,7 +249,7 @@ continue; } final G gameObject = archList.get(MainControl.rnd.nextInt(archList.size())); - mapView.getMapControl().getMapModel().addCopyToMap(gameObject, p, false, fillBelow); + mapView.getMapControl().getMapModel().addCopyToMap(gameObject, p, false, insertionMode); } mapView.getMapControl().getMapModel().endTransaction(); } Modified: trunk/src/app/net/sf/gridarta/MapImageCache.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -135,7 +135,7 @@ * @param mapFile the map file to return the icon image for * @return the icon image */ - @NotNull + @Nullable public ImageIcon getOrCreateIcon(@NotNull final File mapFile) { final ImageIcon cachedIcon = lookupCache(mapFile, Type.ICON); if (cachedIcon != null || mapFile.isDirectory()) { Modified: trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java =================================================================== --- trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -25,6 +25,7 @@ import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -86,7 +87,7 @@ if (mapControl.getMapModel().isPointValid(p) && mapModel.getMapSquare(p).isEmpty()) { area[p.x][p.y] = WAS_EMPTY; final G gameObject = archList.get(MainControl.rnd.nextInt(archList.size())); - mapControl.getMapModel().addCopyToMap(gameObject, p, false, false); + mapControl.getMapModel().addCopyToMap(gameObject, p, false, InsertionMode.TOPMOST); try { if (area[p.x - 1][p.y] == NOT_LOOKED_AT) { area[p.x - 1][p.y] = BORDER; Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -37,6 +37,7 @@ import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserListener; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; @@ -152,8 +153,8 @@ /** {@inheritDoc} */ @Nullable - public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany) { - return pickmapActive ? pickmapChooserControl.insertSelectedObject(mapModel, pos, allowMany) : archetypeChooserControl.insertSelectedArchetype(mapModel, pos, allowMany); + public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, final InsertionMode insertionMode) { + return pickmapActive ? pickmapChooserControl.insertSelectedObject(mapModel, pos, allowMany, insertionMode) : archetypeChooserControl.insertSelectedArchetype(mapModel, pos, allowMany, insertionMode); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -43,6 +43,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -448,7 +449,7 @@ public void fillAbove() { final MapView<G, A, R, V> mapView = getFillAboveEnabled(); if (mapView != null) { - fillWanted(mapView, false); + fillWanted(mapView, InsertionMode.TOPMOST); } } @@ -456,25 +457,24 @@ public void fillBelow() { final MapView<G, A, R, V> mapView = getFillBelowEnabled(); if (mapView != null) { - fillWanted(mapView, true); + fillWanted(mapView, InsertionMode.BOTTOMMOST); } } /** * "Fill" was selected from the Edit menu. * @param mapView the map view to fill - * @param fillBelow true if "Fill Below" was activated, false if "Fill - * Above" + * @param insertionMode the insertion mode to use */ - private void fillWanted(@NotNull final MapView<G, A, R, V> mapView, final boolean fillBelow) { - mainControl.getCopyBuffer().fill(mapView, fillBelow, null, -1); + private void fillWanted(@NotNull final MapView<G, A, R, V> mapView, final InsertionMode insertionMode) { + mainControl.getCopyBuffer().fill(mapView, insertionMode, null, -1); } /** "Random fill above" was selected from the Edit menu. */ public void randFillAbove() { final MapView<G, A, R, V> mapView = getRandFillAboveEnabled(); if (mapView != null) { - fillRandomWanted(mapView, false); + fillRandomWanted(mapView, InsertionMode.TOPMOST); } } @@ -482,18 +482,19 @@ public void randFillBelow() { final MapView<G, A, R, V> mapView = getRandFillBelowEnabled(); if (mapView != null) { - fillRandomWanted(mapView, true); + fillRandomWanted(mapView, InsertionMode.BOTTOMMOST); } } /** * "RandomFill" was selected from the Edit menu. * @param mapView the map view to fill - * @param fillBelow true if "Fill Below" was activated, false if "Fill - * Above" + * @param insertionMode the insertion mode to use */ - private void fillRandomWanted(@NotNull final MapView<G, A, R, V> mapView, final boolean fillBelow) { - final StringBuilder title = new StringBuilder(fillBelow ? "Random fill below " : "Random fill above "); + private void fillRandomWanted(@NotNull final MapView<G, A, R, V> mapView, final InsertionMode insertionMode) { + final StringBuilder title = new StringBuilder("Random fill "); + title.append(insertionMode); + title.append(" "); final G arch = objectChooser.getObjectChooserHighlight(); MapControl<G, A, R, V> pickmap = null; @@ -531,7 +532,7 @@ if (rand < 1 || rand > 100) { JOptionPane.showMessageDialog(mainControl.getMainView(), "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); } else { - mainControl.getCopyBuffer().fill(mapView, fillBelow, pickmap == null ? null : pickmap.getMapViewFrame(), rand); + mainControl.getCopyBuffer().fill(mapView, insertionMode, pickmap == null ? null : pickmap.getMapViewFrame(), rand); break; } } Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -24,6 +24,7 @@ import javax.swing.JMenu; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; @@ -95,11 +96,12 @@ * @param pos The location to add to. * @param allowMany Whether to allow multiple copies of the inserted game * object. + * @param insertionMode the insertion mode to use * @return The inserted game object, or <code>null</code> if nothing was * inserted. */ @Nullable - G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany); + G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode insertionMode); /** * Sets the pickmap folders menu to manage. Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -43,6 +43,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapSquare; @@ -364,7 +365,7 @@ // insert replacement object if (randomArch.isMulti()) { // multi's cannot be inserted properly, so we just put them ontop - mapControl.getMapModel().insertArchetype(randomArch.getArchetypeName(), new Point(square.getMapX(), square.getMapY()), false, false, false); + mapControl.getMapModel().insertArchetype(randomArch.getArchetypeName(), new Point(square.getMapX(), square.getMapY()), false, false, InsertionMode.TOPMOST); // TODO: if from pickmap it could have special attributes -> copy them } else { Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -30,6 +30,7 @@ import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; @@ -265,7 +266,7 @@ // [prevPos] = [pos] for (final G gameObject : mapModel.getMapSquare(pos)) { if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject)) { - mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), false); + mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); gameObjectsToDelete.add(gameObject); } } @@ -275,7 +276,7 @@ // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject); - mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), false); + mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); } else { @@ -295,7 +296,7 @@ // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject); - mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), false); + mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); } Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -41,6 +41,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; @@ -343,12 +344,13 @@ * @param pos the location to add to * @param allowMany whether to allow multiple copies of the inserted game * object + * @param insertionMode the insertion mode to use * @return the inserted game object, or <code>null</code> if nothing was * inserted */ @Nullable - public G insertSelectedArchetype(final MapModel<G, A, R> mapModel, final Point pos, final boolean allowMany) { - return selectedArch == null ? null : mapModel.insertArchetype(selectedArch.getArchetypeName(), pos, allowMany, true, false); + public G insertSelectedArchetype(final MapModel<G, A, R> mapModel, final Point pos, final boolean allowMany, final InsertionMode insertionMode) { + return selectedArch == null ? null : mapModel.insertArchetype(selectedArch.getArchetypeName(), pos, allowMany, true, insertionMode); } } // class ArchetypeChooserControl Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -20,7 +20,10 @@ package net.sf.gridarta.gui.map.tools; import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.Point; +import javax.swing.JComboBox; import javax.swing.JPanel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -29,10 +32,11 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.gui.undo.SwingUtils; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.ToggleAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,13 +47,39 @@ */ public class InsertionTool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends BasicAbstractTool<G, A, R, V> { + /** + * Index into {@link #modeComboBox}: guess insertion location. + */ + private static final int MODE_AUTO = 0; + + /** + * Index into {@link #modeComboBox}: insert topmost. + */ + private static final int MODE_TOPMOST = 1; + + /** + * Index into {@link #modeComboBox}: insert above floor. + */ + private static final int MODE_ABOVE_FLOOR = 2; + + /** + * Index into {@link #modeComboBox}: insert below floor. + */ + private static final int MODE_BELOW_FLOOR = 3; + + /** + * Index into {@link #modeComboBox}: insert bottommost. + */ + private static final int MODE_BOTTOMMOST = 4; + /** Action Factory. */ @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta.gui.map.tools"); - /** The ToggleAction for toggling the insertBelow status. */ - @SuppressWarnings({"UnusedDeclaration"}) - private final ToggleAction insertBelowAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "insertBelow", this); + /** + * The {@link JComboBox} for selecting the insertion mode. + */ + private final JComboBox modeComboBox = createModeComboBox(); /** The main control. */ @NotNull @@ -59,9 +89,6 @@ @NotNull private final ObjectChooser<G, A, R> objectChooser; - /** The position for insertion. */ - private boolean insertBelow; - /** * Create a BasicAbstractTool. * @param selectedSquareView the selected square view @@ -118,7 +145,33 @@ mapControl.insertMapArchToPickmap(p); insertedObject = null; } else { - insertedObject = objectChooser.insertSelectedObject(mapControl.getMapModel(), p, isPressed); + final int modeIndex = modeComboBox.getSelectedIndex(); + final InsertionMode insertionMode; + switch (modeIndex) { + case MODE_AUTO: + insertionMode = InsertionMode.AUTO; + break; + + case MODE_TOPMOST: + insertionMode = InsertionMode.TOPMOST; + break; + + case MODE_ABOVE_FLOOR: + insertionMode = InsertionMode.ABOVE_FLOOR; + break; + + case MODE_BELOW_FLOOR: + insertionMode = InsertionMode.BELOW_FLOOR; + break; + + case MODE_BOTTOMMOST: + insertionMode = InsertionMode.BOTTOMMOST; + break; + + default: + throw new AssertionError(); + } + insertedObject = objectChooser.insertSelectedObject(mapControl.getMapModel(), p, isPressed || modeIndex == MODE_AUTO, insertionMode); } mapControl.getMapModel().endTransaction(); selectedSquareView.setSelectedGameObject(insertedObject); @@ -128,26 +181,41 @@ @Override @Nullable public Component createOptionsView() { - final JPanel optionsPanel = new JPanel(); - // commented to hide it because currently inserting below doesn't work. - //optionsPanel.add(insertBelowAction.createCheckBox()); - return optionsPanel; - } + final JPanel panel = new JPanel(); + panel.setLayout(new GridBagLayout()); - /** - * Returns the position for insertion. - * @return the position for insertion. - */ - public boolean isInsertBelow() { - return insertBelow; + final GridBagConstraints gbcLabel = new GridBagConstraints(); + gbcLabel.anchor = GridBagConstraints.EAST; + + final GridBagConstraints gbcComboBox = new GridBagConstraints(); + gbcComboBox.fill = GridBagConstraints.HORIZONTAL; + gbcComboBox.weightx = 1; + gbcComboBox.gridwidth = GridBagConstraints.REMAINDER; + + final GridBagConstraints gbcCheckBox = new GridBagConstraints(); + gbcCheckBox.fill = GridBagConstraints.HORIZONTAL; + gbcCheckBox.gridwidth = GridBagConstraints.REMAINDER; + + panel.add(SwingUtils.createLabel("insertionTool.mode", modeComboBox), gbcLabel); + panel.add(modeComboBox, gbcComboBox); + return panel; } /** - * Sets the position for insertion. - * @param insertBelow the position for insertion. + * Create a {@link JComboBox} for selecting the scope to delete. + * @return the combo box */ - public void setInsertBelow(final boolean insertBelow) { - this.insertBelow = insertBelow; + private static JComboBox createModeComboBox() { + final String[] options = new String[] { + ACTION_FACTORY.getString("insertionTool.mode.auto"), + ACTION_FACTORY.getString("insertionTool.mode.topmost"), + ACTION_FACTORY.getString("insertionTool.mode.aboveFloor"), + ACTION_FACTORY.getString("insertionTool.mode.belowFloor"), + ACTION_FACTORY.getString("insertionTool.mode.bottommost"), + }; + final JComboBox comboBox = new JComboBox(options); + comboBox.setToolTipText(ACTION_FACTORY.getString("insertionTool.mode.shortdescription")); + return comboBox; } } // class InsertionTool Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-22 18:45:23 UTC (rev 4386) @@ -22,10 +22,9 @@ deletion.icon=misc/Delete16 deletion.shortdescription=Delete objects. insertion.icon=misc/Insert16 -insertion.shortdescription=Insert topmost objects. +insertion.shortdescription=Insert objects. void.icon=misc/Void16 void.shortdescription=Do nothing (makes selected mouse button inactive). -insertBelow.text=Insert below left=left middle=middle right=right @@ -52,3 +51,11 @@ deletionToolExceptionsIgnoreFloors.shortdescription=Prevents floors from being deleted. deletionToolExceptionsIgnoreMonsters.text=ignore monsters deletionToolExceptionsIgnoreMonsters.shortdescription=Prevents monsters from being deleted. + +insertionTool.mode.text=Mode: +insertionTool.mode.shortdescription=<html>Selects the insertion mode:<br>auto=guess insertion point depending on object type<br>topmost=insert above existing objects<br>above floor=insert right above floor<br>below floor=insert right below floor<br>bottom=insert below existing objects +insertionTool.mode.auto=auto +insertionTool.mode.topmost=topmost +insertionTool.mode.aboveFloor=above floor +insertionTool.mode.belowFloor=below floor +insertionTool.mode.bottommost=bottommost Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-22 18:45:23 UTC (rev 4386) @@ -19,9 +19,8 @@ selection.shortdescription=Kartenbereich ausw\xE4hlen. deletion.shortdescription=L\xF6schen von Objekten. -insertion.shortdescription=Objekte oben einf\xFCgen. +insertion.shortdescription=Objekte einf\xFCgen. void.shortdescription=Nichts (deaktiviert die Maustaste). -insertBelow.text=Unten einf\xFCgen left=links middle=mitte right=rechts @@ -48,3 +47,11 @@ deletionToolExceptionsIgnoreFloors.shortdescription=Verhindert das L\xF6schen vom Boden. deletionToolExceptionsIgnoreMonsters.text=Monster ignorieren deletionToolExceptionsIgnoreMonsters.shortdescription=Verhindert das L\xF6schen von Monstern. + +insertionTool.mode.text=Modus: +insertionTool.mode.shortdescription=<html>W\xE4hlt den Einf\xFCgemodus:<br>automatisch=abh\xE4ngig vom eingef\xFCgten Objekt<br>oben=als oberstes Objekt einf\xFCgen<br>\xFCber Boden=direkt \xFCber Boden einf\xFCgen<br>unter Boden=direkt unter Boden einf\xFCgen<br>unten=als unterstes Objekt einf\xFCgen +insertionTool.mode.auto=auto +insertionTool.mode.topmost=oben +insertionTool.mode.aboveFloor=\xFCber Boden +insertionTool.mode.belowFloor=unter Boden +insertionTool.mode.bottommost=unten Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-22 18:45:23 UTC (rev 4386) @@ -21,7 +21,6 @@ #deletion.shortdescription= #insertion.shortdescription= #void.shortdescription= -#insertBelow.text= #left= #middle= #right= @@ -48,3 +47,11 @@ #deletionToolExceptionsIgnoreFloors.shortdescription= #deletionToolExceptionsIgnoreMonsters.text= #deletionToolExceptionsIgnoreMonsters.shortdescription= + +#insertionTool.mode.text= +#insertionTool.mode.shortdescription= +#insertionTool.mode.auto=auto +#insertionTool.mode.topmost= +#insertionTool.mode.aboveFloor= +#insertionTool.mode.belowFloor= +#insertionTool.mode.bottommost= Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-22 18:45:23 UTC (rev 4386) @@ -21,7 +21,6 @@ #deletion.shortdescription= #insertion.shortdescription= #void.shortdescription= -#insertBelow.text= #left= #middle= #right= @@ -48,3 +47,11 @@ #deletionToolExceptionsIgnoreFloors.shortdescription= #deletionToolExceptionsIgnoreMonsters.text= #deletionToolExceptionsIgnoreMonsters.shortdescription= + +#insertionTool.mode.text= +#insertionTool.mode.shortdescription= +#insertionTool.mode.auto=auto +#insertionTool.mode.topmost= +#insertionTool.mode.aboveFloor= +#insertionTool.mode.belowFloor= +#insertionTool.mode.bottommost= Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -38,6 +38,7 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlListener; @@ -394,13 +395,14 @@ * @param pos the location to add to * @param allowMany whether to allow multiple copies of the inserted game * object + * @param insertionMode the insertion mode to use * @return the inserted game object, or <code>null</code> if nothing was * inserted */ @Nullable - public G insertSelectedObject(final MapModel<G, A, R> mapModel, final Point pos, final boolean allowMany) { + public G insertSelectedObject(final MapModel<G, A, R> mapModel, final Point pos, final boolean allowMany, final InsertionMode insertionMode) { final G gameObject = getSelection(); - return gameObject == null ? null : mapModel.insertGameObject(gameObject, pos, allowMany); + return gameObject == null ? null : mapModel.insertGameObject(gameObject, pos, allowMany, insertionMode); } } // class PickmapChooserControl Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -191,7 +191,7 @@ if (objects != null) { for (final G gameObject : objects) { if (!gameObject.isInContainer()) { // only map arches.... - addGameObjectToMap(gameObject, false); + addGameObjectToMap(gameObject, InsertionMode.TOPMOST); } } } @@ -634,7 +634,7 @@ // put arch on the map if (templateGameObject.isArchetype()) { - newGameObject = insertArchetype(templateGameObject.getArchetypeName(), pos, true, join, false); + newGameObject = insertArchetype(templateGameObject.getArchetypeName(), pos, true, join, InsertionMode.TOPMOST); if (newGameObject == null) { return null; } @@ -642,7 +642,7 @@ // insert the given 'templateGameObject' (multis not allowed here yet - sorry) if (!templateGameObject.isMulti()) { newGameObject = templateGameObject.createClone(pos.x, pos.y); - addGameObjectToMap(newGameObject, false); + addGameObjectToMap(newGameObject, InsertionMode.TOPMOST); } else { return null; // tried to insert multi (probably from pickmap) } @@ -683,7 +683,7 @@ /** {@inheritDoc} */ @Nullable - public G insertArchetype(@Nullable final String archetypeName, @NotNull final Point pos, final boolean allowDouble, final boolean join, final boolean insertBelow) { + public G insertArchetype(@Nullable final String archetypeName, @NotNull final Point pos, final boolean allowDouble, final boolean join, final InsertionMode insertionMode) { if (archetypeName == null || archetypeName.length() == 0 || !isPointValid(pos)) { return null; } @@ -720,14 +720,6 @@ final int mapx = pos.x + part.getMultiX(); final int mapy = pos.y + part.getMultiY(); - part.setMapX(mapx); - part.setMapY(mapy); - if (insertBelow) { - mapGrid[mapx][mapy].addFirst(part); - } else { - mapGrid[mapx][mapy].addLast(part); - } - final Integer direction = archetypeChooserControl.getCurrentDirection(); if (direction != null) { part.setDirection(direction); @@ -735,6 +727,10 @@ } part.postParseGameObject(mapControl.getActiveEditType()); part.setObjectFace(); + + part.setMapX(mapx); + part.setMapY(mapy); + insertionMode.insert(part, mapGrid[mapx][mapy]); } for (final G invObject : archetype) { @@ -746,7 +742,7 @@ /** {@inheritDoc} */ @Nullable - public G insertGameObject(@NotNull final G gameObject, @NotNull final Point pos, final boolean allowMany) { + public G insertGameObject(@NotNull final G gameObject, @NotNull final Point pos, final boolean allowMany, final InsertionMode insertionMode) { if (!allowMany) { // check if there is already an arch of that kind for (final G t : getMapSquare(pos)) { @@ -760,14 +756,14 @@ if (!gameObject.isMulti()) { // insert single tile from pickmap final G newObject = gameObject.createClone(pos.x, pos.y); - addGameObjectToMap(newObject, false); + addGameObjectToMap(newObject, insertionMode); return newObject; } // insert multi tile from pickmap: final G newarchHead = gameObject.getHead(); // first insert default arch from archlist - final G newObject = insertArchetype(newarchHead.getArchetypeName(), pos, allowMany, false, false); + final G newObject = insertArchetype(newarchHead.getArchetypeName(), pos, allowMany, false, insertionMode); if (newObject != null) { newObject.setObjectText(newarchHead.getObjectText()); newObject.setObjName(newarchHead.getObjName()); @@ -778,7 +774,7 @@ } /** {@inheritDoc} */ - public void addGameObjectToMap(final G gameObject, final boolean insertBelow) { + public void addGameObjectToMap(final G gameObject, final InsertionMode insertionMode) { gameObject.setObjectFace(); final int mapx = gameObject.getMapX(); @@ -791,12 +787,7 @@ return; } - if (insertBelow) { - mapGrid[mapx][mapy].addFirst(gameObject); - } else { - mapGrid[mapx][mapy].addLast(gameObject); - } - + insertionMode.insert(gameObject, mapGrid[mapx][mapy]); gameObject.updateEditType(mapControl.getActiveEditType()); } @@ -854,9 +845,9 @@ } // class MapSquareIterator /** {@inheritDoc} */ - public void addCopyToMap(final G gameObject, final Point pos, final boolean allowDouble, final boolean fillBelow) { + public void addCopyToMap(final G gameObject, final Point pos, final boolean allowDouble, final InsertionMode insertionMode) { if (gameObject.isArchetype()) { - insertArchetype(gameObject.getArchetypeName(), pos, allowDouble, false, fillBelow); + insertArchetype(gameObject.getArchetypeName(), pos, allowDouble, false, insertionMode); } else { final G newGameObject = gameObject.createMultiClone(pos.x, pos.y); for (G tmp = newGameObject; tmp != null; tmp = tmp.getMultiNext()) { @@ -866,9 +857,9 @@ } } - addGameObjectToMap(newGameObject, fillBelow); + addGameObjectToMap(newGameObject, insertionMode); for (G tmp = newGameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - addGameObjectToMap(tmp, fillBelow); + addGameObjectToMap(tmp, insertionMode); tmp.postParseGameObject(mapControl.getActiveEditType()); } } @@ -892,7 +883,7 @@ } } - addCopyToMap(newarch2, pos, true, false); + addCopyToMap(newarch2, pos, true, InsertionMode.TOPMOST); } } // class DefaultMapModel Added: trunk/src/app/net/sf/gridarta/map/InsertionMode.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/InsertionMode.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/InsertionMode.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -0,0 +1,231 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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.map; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Insertion modes. + * @todo make replacement of multi-part objects work + * @author Andreas Kirschbaum + */ +public enum InsertionMode { + + /** + * Automatically guess the insertion position. May replace rather than + * insert the object. + */ + AUTO { + + /** {@inheritDoc} */ + public <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare) { + if (floorGameObjectMatcher != null && floorGameObjectMatcher.isMatching(gameObject)) { + replaceFloor(gameObject, mapSquare, mapSquare.getLast(floorGameObjectMatcher)); + } else if (wallGameObjectMatcher != null && wallGameObjectMatcher.isMatching(gameObject)) { + replaceWall(gameObject, mapSquare, mapSquare.getLast(wallGameObjectMatcher)); + } else if (belowFloorGameObjectMatcher != null && belowFloorGameObjectMatcher.isMatching(gameObject)) { + mapSquare.addFirst(gameObject); + } else { + mapSquare.addLast(gameObject); + } + } + + /** {@inheritDoc} */ + public String toString() { + return "auto"; + } + }, + + /** + * Insert topmost. + */ + TOPMOST { + + /** {@inheritDoc} */ + public <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare) { + mapSquare.addLast(gameObject); + } + + /** {@inheritDoc} */ + public String toString() { + return "topmost"; + } + + }, + + /** + * Insert right above the topmost floor tile. Inserts bottommost if no + * floor tile exists. + */ + ABOVE_FLOOR { + + /** {@inheritDoc} */ + public <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare) { + if (floorGameObjectMatcher == null) { + mapSquare.addFirst(gameObject); + return; + } + + final G lastFloor = mapSquare.getLast(floorGameObjectMatcher); + if (lastFloor == null) { + mapSquare.addFirst(gameObject); + return; + } + + mapSquare.insertBefore(gameObject, lastFloor); + } + + /** {@inheritDoc} */ + public String toString() { + return "above floor"; + } + + }, + + /** + * Insert right below the bottommost floor tile. Inserts bottommost if no + * floor tile exists. + */ + BELOW_FLOOR { + + /** {@inheritDoc} */ + public <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare) { + if (floorGameObjectMatcher == null) { + mapSquare.addFirst(gameObject); + return; + } + final G firstFloor = mapSquare.getFirst(floorGameObjectMatcher); + if (firstFloor == null) { + mapSquare.addFirst(gameObject); + return; + } + + mapSquare.insertAfter(firstFloor, gameObject); + } + + /** {@inheritDoc} */ + public String toString() { + return "below floor"; + } + + }, + + /** + * Insert bottommost. + */ + BOTTOMMOST { + + /** {@inheritDoc} */ + public <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare) { + mapSquare.addFirst(gameObject); + } + + /** {@inheritDoc} */ + public String toString() { + return "bottommost"; + } + + }; + + /** + * A {@link GameObjectMatcher} matching floor game objects. + */ + @Nullable + private static GameObjectMatcher floorGameObjectMatcher = null; + + /** + * A {@link GameObjectMatcher} matching wall game objects. + */ + @Nullable + private static GameObjectMatcher wallGameObjectMatcher = null; + + /** + * A {@link GameObjectMatcher} matching monster game objects. + */ + @Nullable + private static GameObjectMatcher belowFloorGameObjectMatcher = null; + + /** + * Initializes the class. + * @param floorGameObjectMatcher the floor matcher to use + * @param wallGameObjectMatcher the wall matcher to use + * @param belowFloorGameObjectMatcher the game object to insert below the + * floor + */ + public static void init(@Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher belowFloorGameObjectMatcher) { + InsertionMode.floorGameObjectMatcher = floorGameObjectMatcher; + InsertionMode.wallGameObjectMatcher = wallGameObjectMatcher; + InsertionMode.belowFloorGameObjectMatcher = belowFloorGameObjectMatcher; + } + + /** + * Inserts a {@link GameObject} into a {@link MapSquare}. + * @param gameObject the game object to insert + * @param mapSquare the map square to modify + */ + public abstract <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void insert(@NotNull final G gameObject, @NotNull final MapSquare<G, A, R> mapSquare); + + /** + * Replace a floor game object. + * @param gameObject the game object to insert with + * @param mapSquare the map square to modify + * @param lastFloor the last floor game object within + * <code>mapSquare</code> + */ + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void replaceFloor(final G gameObject, final MapSquare<G, A, R> mapSquare, final G lastFloor) { + // floor exists ==> replace it + if (lastFloor != null && !lastFloor.isMulti()) { + mapSquare.replace(lastFloor, gameObject); + return; + } + + // "below floor" objects exist ==> insert afterwards + if (belowFloorGameObjectMatcher != null) { + final G lastBelowFloor = mapSquare.getLastOfLeadingSpan(belowFloorGameObjectMatcher); + if (lastBelowFloor != null) { + mapSquare.insertAfter(lastBelowFloor, gameObject); + return; + } + } + + // fallback ==> insert bottommost + mapSquare.addFirst(gameObject); + } + + /** + * Replace a wall game object. + * @param gameObject the game object to insert with + * @param mapSquare the map square to modify + * @param lastWall the last wall game object within + * <code>mapSquare</code> + */ + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void replaceWall(final G gameObject, final MapSquare<G, A, R> mapSquare, final G lastWall) { + if (lastWall != null && !lastWall.isMulti()) { + mapSquare.replace(lastWall, gameObject); + } else { + mapSquare.addLast(gameObject); + } + } + +} // enum InsertionMode Property changes on: trunk/src/app/net/sf/gridarta/map/InsertionMode.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/map/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapModel.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/map/MapModel.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -302,11 +302,10 @@ * <var>gameObject</var> is a new and unlinked object. * @param gameObject The new GameObject with set destination coordinates to * be linked onto the map. - * @param insertBelow <code>true</code> to insert at top, <code>false</code> - * for below + * @param insertionMode the insertion mode to use * @todo verify <code>insertBelow</code> documentation */ - void addGameObjectToMap(G gameObject, boolean insertBelow); + void addGameObjectToMap(G gameObject, InsertionMode insertionMode); /** * Return the current state of this object. @@ -332,8 +331,7 @@ * inserted per square * @param join if set, auto-joining is supported; autojoining is only done * if enabled in the main control - * @param insertBelow true: new arch is inserted on top, false: new arch is - * inserted below + * @param insertionMode the insertion mode to use * @return The head of the inserted object or <code>null</code> if for some * reason no object could be inserted. * @todo discuss whether this method really belongs to a map model, as @@ -343,18 +341,19 @@ * than returning <code>null</code>. */ @Nullable - G insertArchetype(@Nullable String archetypeName, @NotNull Point pos, boolean allowDouble, boolean join, boolean insertBelow); + G insertArchetype(@Nullable String archetypeName, @NotNull Point pos, boolean allowDouble, boolean join, final InsertionMode insertionMode); /** * Adds a {@link GameObject} to the map. * @param gameObject the game object to insert * @param pos the insert-location on this map * @param allowMany whether duplicates are allowed + * @param insertionMode the insertion mode to use * @return the inserted game object or <code>null</code> if nothing was * inserted */ @Nullable - G insertGameObject(@NotNull G gameObject, @NotNull Point pos, boolean allowMany); + G insertGameObject(@NotNull G gameObject, @NotNull Point pos, boolean allowMany, final InsertionMode insertionMode); /** * Checks whether an GameObject (multi-arch) would still fit on this map. @@ -440,10 +439,9 @@ * @param pos position to add GameObject at * @param allowDouble <code>true</code> for allowing similar GameObjects on * the same square, <code>false</code> to disallow - * @param fillBelow <code>true</code> if the GameObject should be added - * below all others, <code>false</code> for above + * @param insertionMode the insertion mode to use */ - void addCopyToMap(G gameObject, Point pos, boolean allowDouble, boolean fillBelow); + void addCopyToMap(G gameObject, Point pos, boolean allowDouble, InsertionMode insertionMode); /** * This method is only called for pickmaps. Take the currently highlighted Modified: trunk/src/app/net/sf/gridarta/map/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-22 18:37:53 UTC (rev 4385) +++ trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-22 18:45:23 UTC (rev 4386) @@ -117,6 +117,22 @@ } /** + * Returns the last occurrence of a matching game object. + * @param gameObjectMatcher the matcher to use + * @return the last match, or <code>null</code> if no such game object + * exists + */ + @Nullable + public G getLast(@NotNull final GameObjectMatcher gameObjectMatcher) { + for (final G gameObject : reverse()) { + if (gameObjectMatcher.isMatching(gameObject)) { + return gameObject; + } + } + return null; + } + + /** * Returns the game object after the last occurrence of a matching game * object. * @param gameObjectMatcher the matcher to use @@ -136,6 +152,22 @@ } /** + * Returns the first occurrence of a matching game object. + * @param gameObjectMatcher the matcher to use + * @return the first match, or <code>null</code> if no such game object + * exists + */ + @Nullable + public G getFirst(@NotNull final GameObjectMatcher gameObjectMatcher) { + for (final G gameObject : this) { + if (gameObjectMatcher.isMatching(gameObject)) { + return gameObject; + } + } + return null; + } + + /** * Returns the game object before the first occurrence of a matching game * object. * @param gameObjectMatcher the matcher to use @@ -153,4 +185,24 @@ } return null; } + + /** + * Returns the last game object of the initial segment of matching game + * objects. + * @param gameObjectMatcher the matcher to use + * @return the result or <code>null</code> if the first game object does + * not match <code>gameObjectMatcher</code> + */ + @Nullable + public G getLastOfLeadingSpan(@NotNull final GameObjectMatcher gameObjectMatcher) { + @Nullable G result = null; + for (final G tmp : this) { + if (!gameObjectMatcher.isMatching(tmp)) { + break; + } + result = tmp; + } + return result; + } + } // class MapSquare This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-22 21:06:27
|
Revision: 4391 http://gridarta.svn.sourceforge.net/gridarta/?rev=4391&view=rev Author: akirschbaum Date: 2008-07-22 21:06:34 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-22 21:02:42 UTC (rev 4390) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) @@ -124,7 +124,7 @@ * @param selectedSquareView the selected square view */ public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mapControl, mainControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); + super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); mapCursor.addMapCursorListener(mapCursorListener); renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-22 21:02:42 UTC (rev 4390) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) @@ -126,7 +126,7 @@ * @param selectedSquareView the selected square view */ public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mapControl, mainControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); + super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); mapCursor.addMapCursorListener(mapCursorListener); renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-22 21:02:42 UTC (rev 4390) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) @@ -29,7 +29,6 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -71,9 +70,6 @@ /** The controller of this view. */ private final MapControl<G, A, R, V> mapControl; - /** The CMainControl. */ - private final MainControl<G, A, R, V> mainControl; - /** The tile palette renderer. */ protected AbstractLevelRenderer<G, A, R> renderer; @@ -86,14 +82,13 @@ /** * Creates a MapViewBasic. * @param mapControl MapControl to use. - * @param mainControl the main controller * @param initial the initial view position to show; null=show top left * corner * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param selectedSquareView the selected square view */ - protected MapViewBasic(@NotNull final MapControl<G, A, R, V> mapControl, @NotNull final MainControl<G, A, R, V> mainControl, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + protected MapViewBasic(@NotNull final MapControl<G, A, R, V> mapControl, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); this.selectedSquareView = selectedSquareView; mapModel = mapControl.getMapModel(); @@ -105,7 +100,6 @@ mapCursor.addMapCursorListener(selectedSquareView); } this.mapControl = mapControl; - this.mainControl = mainControl; // set the pixel increment scrolling for clicking once on a scrollbar arrow getVerticalScrollBar().setUnitIncrement(yScrollDistance); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 11:46:44
|
Revision: 4392 http://gridarta.svn.sourceforge.net/gridarta/?rev=4392&view=rev Author: akirschbaum Date: 2008-07-23 11:46:47 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Make members private. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/script/parameter/BooleanParameter.java trunk/crossfire/src/cfeditor/script/parameter/DoubleParameter.java trunk/crossfire/src/cfeditor/script/parameter/FilterParameter.java trunk/crossfire/src/cfeditor/script/parameter/IntegerParameter.java trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java trunk/crossfire/src/cfeditor/script/parameter/PluginParameter.java trunk/crossfire/src/cfeditor/script/parameter/StringParameter.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -244,7 +244,7 @@ PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, false); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); Modified: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java =================================================================== --- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -95,7 +95,7 @@ setMapDir(new File(getCurrentDir().getAbsolutePath())); } // if mapdir has no absolute path, set it now - if (getCurrentDir().exists() && getMapDir().getParent() == null && !getMapDir().isAbsolute() && !hasChangedDir) { + if (getCurrentDir().exists() && getMapDir().getParent() == null && !getMapDir().isAbsolute() && !hasChangedDir()) { setMapDir(new File(getCurrentDir().getAbsolutePath(), getMapDir().getPath())); } } Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -206,7 +206,7 @@ if ((len = name.length()) >= 4) { if (name.regionMatches(len - 4, ".arc", 0, 4)) { //mainControl.setStatusText("Loading Arch: "+name); - currentFile = f; + setCurrentFile(f); archetypeParser.parseArchetype(f.getAbsolutePath(), panelName, folderName, invObjects); } else if (name.regionMatches(len - 4, ".png", 0, 4)) { //mainControl.setStatusText("Loading PNG: "+name); Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -63,11 +63,14 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; + @NotNull + private final MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic> mapUserListener; + private final MapModelListener<GameObject, MapArchObject, Archetype> mapModelListener = new MapModelListener<GameObject, MapArchObject, Archetype>() { /** {@inheritDoc} */ public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - mapGrid.resize(e.getMapModel().getMapSize()); + getMapGrid().resize(e.getMapModel().getMapSize()); } /** {@inheritDoc} */ @@ -125,9 +128,9 @@ */ public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); - mapCursor.addMapCursorListener(mapCursorListener); + getMapCursor().addMapCursorListener(mapCursorListener); - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, getMapGrid(), faceObjects) : new MapRenderer(mainControl, mapControl, getMapGrid(), faceObjects); setViewportView(renderer); mapModel.addMapModelListener(mapModelListener); @@ -144,7 +147,7 @@ /** {@inheritDoc} */ public void closeNotify() { super.closeNotify(); - mapCursor.removeMapCursorListener(mapCursorListener); + getMapCursor().removeMapCursorListener(mapCursorListener); setViewportView(null); mapModel.removeMapModelListener(mapModelListener); renderer.removeMouseListener(mapUserListener); Modified: trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -58,7 +58,7 @@ //--- Data field(s) --- - protected final ImageIcon closingIcon; + private final ImageIcon closingIcon; private static final long serialVersionUID = 1L; @@ -92,7 +92,7 @@ //--- Inner Class(es) --- - protected class ClosingListener extends MouseAdapter { + private class ClosingListener extends MouseAdapter { @Override public void mouseReleased(final MouseEvent e) { Modified: trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -35,7 +35,7 @@ private String valueString; public ArchParameter() { - parameterType = getParameterType(); + super(getParameterType()); } @Override Modified: trunk/crossfire/src/cfeditor/script/parameter/BooleanParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/BooleanParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/BooleanParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -26,7 +26,7 @@ public class BooleanParameter extends PluginParameter { public BooleanParameter() { - parameterType = getParameterType(); + super(getParameterType()); } @Override Modified: trunk/crossfire/src/cfeditor/script/parameter/DoubleParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/DoubleParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/DoubleParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -26,7 +26,7 @@ public class DoubleParameter extends PluginParameter { public DoubleParameter() { - parameterType = getParameterType(); + super(getParameterType()); } @Override Modified: trunk/crossfire/src/cfeditor/script/parameter/FilterParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/FilterParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/FilterParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -31,8 +31,8 @@ private final NamedFilterList defaultFilterList; public FilterParameter(final NamedFilterList defaultFilterList) { + super(getParameterType()); this.defaultFilterList = defaultFilterList; - parameterType = getParameterType(); } @Override Modified: trunk/crossfire/src/cfeditor/script/parameter/IntegerParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/IntegerParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/IntegerParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -26,7 +26,7 @@ public class IntegerParameter extends PluginParameter { public IntegerParameter() { - parameterType = getParameterType(); + super(getParameterType()); } @Override Modified: trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -32,7 +32,7 @@ public class MapParameter extends PluginParameter { public MapParameter() { - parameterType = getParameterType(); + super(getParameterType()); } /* (non-Javadoc) Modified: trunk/crossfire/src/cfeditor/script/parameter/PluginParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/PluginParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -43,8 +43,14 @@ private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(); - protected String parameterType; + private final String parameterType; + protected PluginParameter(final String parameterType) { + this.parameterType = parameterType; + setName("[name]"); + setDescription("[description]"); + } + public Object getConfig() { return config; } @@ -117,10 +123,6 @@ return parameterType; } - public static String getParameterType() { - throw new UnsupportedOperationException("Can not call " + PluginParameter.class.getName() + ".getParameterType() !"); - } - public void addChangeListener(final ChangeListener listener) { listeners.add(listener); } @@ -136,11 +138,6 @@ } } - protected PluginParameter() { - setName("[name]"); - setDescription("[description]"); - } - @Nullable @Override public Object clone() throws CloneNotSupportedException { Modified: trunk/crossfire/src/cfeditor/script/parameter/StringParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/StringParameter.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/crossfire/src/cfeditor/script/parameter/StringParameter.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -58,7 +58,7 @@ } public StringParameter() { - parameterType = getParameterType(); + super(getParameterType()); if (log.isDebugEnabled()) { log.debug("New instance of " + StringParameter.class.getName()); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -297,7 +297,7 @@ PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, true); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -376,7 +376,7 @@ if (f.isFile()) { // watch out for stuff that's not a file and not a directory!!! if (name.endsWith(".arc")) { //mainControl.setStatusText("Loading Arch: "+ name); - currentFile = f; + setCurrentFile(f); archetypeParser.parseArchetype(f.getPath(), panelName, folderName, invObjects); } else if (name.endsWith(".png")) { //mainControl.setStatusText("Loading PNG: "+ name); Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -63,11 +63,14 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; + @NotNull + private final MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic> mapUserListener; + private final MapModelListener<GameObject, MapArchObject, Archetype> mapModelListener = new MapModelListener<GameObject, MapArchObject, Archetype>() { /** {@inheritDoc} */ public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - mapGrid.resize(e.getMapModel().getMapSize()); + getMapGrid().resize(e.getMapModel().getMapSize()); } /** {@inheritDoc} */ @@ -127,9 +130,9 @@ */ public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); - mapCursor.addMapCursorListener(mapCursorListener); + getMapCursor().addMapCursorListener(mapCursorListener); - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, getMapGrid(), faceObjects) : new MapRenderer(mainControl, mapControl, getMapGrid(), faceObjects); setViewportView(renderer); mapModel.addMapModelListener(mapModelListener); @@ -146,7 +149,7 @@ /** {@inheritDoc} */ public void closeNotify() { super.closeNotify(); - mapCursor.removeMapCursorListener(mapCursorListener); + getMapCursor().removeMapCursorListener(mapCursorListener); setViewportView(null); mapModel.removeMapModelListener(mapModelListener); renderer.removeMouseListener(mapUserListener); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -74,7 +74,7 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** Bit field of edit types to show only. */ - protected int editType = 0; + private int editType = 0; /** Buffer managing copy data. */ private final CopyBuffer<G, A, R, V> copybuffer = new CopyBuffer<G, A, R, V>(this); @@ -89,7 +89,7 @@ private final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); /** The map manager. */ - protected final MapManager<G, A, R, V> mapManager; + private final MapManager<G, A, R, V> mapManager; /** The updater instance. */ protected UpdaterManager updaterManager = null; Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -49,7 +49,7 @@ public final class CopyBuffer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { /** Mode for operations. */ - protected enum CopyMode { + private enum CopyMode { /** Clear the selection. */ DO_CLEAR, Modified: trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -49,7 +49,7 @@ * Indicates whether the user has ever changed the active directory since * the program started. */ - protected boolean hasChangedDir = false; + private boolean hasChangedDir = false; /** {@inheritDoc} */ public String getArchDefaultFolder() { Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -99,7 +99,7 @@ private final Map<Archetype<G, A, R>, File> duplicateArches = new IdentityHashMap<Archetype<G, A, R>, File>(); /** Name of the currently loaded .arc file. */ - protected File currentFile = null; + private File currentFile = null; /** * Create an AbstractArchetypeSet. @@ -277,4 +277,8 @@ return face; } + protected void setCurrentFile(final File currentFile) { + this.currentFile = currentFile; + } + } // class AbstractArchetypeSet Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -57,10 +57,10 @@ private static final long serialVersionUID = 1; /** The archetype chooser control. */ - protected final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + private final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; /** The archetype chooser control. */ - protected final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; /** ToolSelector of this subview. */ private final ToolPalette<G, A, R, V> toolPalette; Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -98,13 +98,13 @@ private final Action aScriptRemove = ACTION_FACTORY.createAction(false, "scriptRemove", this); /** The label that displays the current animation name. */ - protected final JLabel archAnimText = new JLabel(); + private final JLabel archAnimText = new JLabel(); /** The Panel that displays animation information. */ - protected final JPanel animationPanel = createAnimationPanel(); + private final JPanel animationPanel = createAnimationPanel(); /** The Panel that displays scripting information. */ - protected final JPanel scriptPanel = createScriptPanel(); + private final JPanel scriptPanel = createScriptPanel(); /** The MainControl to use, e.g. for accessing AnimationObjects. */ private final MainControl<G, A, R, V> mainControl; @@ -123,7 +123,7 @@ private final SelectedSquareView<G, A, R, V> selectedSquareView; /** The tabs of this GameObjectAttributesPanel. */ - protected final JTabbedPane panelDesktop = new JTabbedPane(SwingConstants.TOP); + private final JTabbedPane panelDesktop = new JTabbedPane(SwingConstants.TOP); /** The selected game object. */ private G selectedGameObject = null; @@ -135,7 +135,7 @@ /** Arch text field. */ private final JTextArea archTextArea = new JTextArea(4, 25); - protected JList eventList; + private JList eventList; /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -63,7 +63,7 @@ private final MapControl<G, A, R, V> mapControl; /** View number. */ - protected final int number; + private final int number; /** The underlying mapview object. */ @NotNull @@ -75,7 +75,7 @@ /** The Action to select this Window. */ @NotNull - protected final WindowAction<G, A, R, V> windowAction; + private final WindowAction<G, A, R, V> windowAction; /** * The {@link MapModelListener} used to detect changes in the map model that Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -55,11 +55,11 @@ /** The grid to use. */ @NotNull - protected final MapGrid mapGrid; + private final MapGrid mapGrid; /** The cursor. */ @NotNull - protected final MapCursor mapCursor; + private final MapCursor mapCursor; /** The MapSquares that are known to contain errors. */ protected final Map<MapSquare<G, A, R>, ValidationError<G, A, R>> erroneousMapSquares = new HashMap<MapSquare<G, A, R>, ValidationError<G, A, R>>(); @@ -74,9 +74,6 @@ protected AbstractLevelRenderer<G, A, R> renderer; @NotNull - protected MapUserListener<G, A, R, V> mapUserListener; - - @NotNull private final SelectedSquareView<G, A, R, V> selectedSquareView; /** Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -54,19 +54,19 @@ private boolean mapSizeDefault; /** The default width for new maps. */ - protected final int defaultWidth; + private final int defaultWidth; /** The default height for new maps. */ - protected final int defaultHeight; + private final int defaultHeight; /** Checkbox to set whether the default width / height should be overridden. */ private final JCheckBox mapSizeDefaultCheckbox = new JCheckBox(ACTION_FACTORY.createToggle(false, "mapSizeDefault", this)); /** Textfield for the width of the new map. */ - protected final JFormattedTextField mapWidthField = new JFormattedTextField(); + private final JFormattedTextField mapWidthField = new JFormattedTextField(); /** Textfield for the height of the new map. */ - protected final JFormattedTextField mapHeightField = new JFormattedTextField(); + private final JFormattedTextField mapHeightField = new JFormattedTextField(); /** * Creates a new instance. Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -48,7 +48,7 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); /** The controller of this new level dialog view. */ - protected final MainControl<G, A, R, V> mainControl; + private final MainControl<G, A, R, V> mainControl; /** The pickmap chooser control. */ private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -68,7 +68,7 @@ /** The {@link GridartaObjectsFactory} instance. */ @NotNull - final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** The main control. */ @NotNull @@ -90,7 +90,7 @@ private boolean modified = false; @Nullable - protected File mapFile; + private File mapFile; /** * The filename of this map. TODO: Rename because the filename is a URI Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -187,7 +187,7 @@ // F10 should be passed on, but C+e F10 // shouldn't repeatCount = 0; - repeat = false; + setRepeatEnabled(false); e.consume(); } currentBindings = bindings; @@ -232,7 +232,7 @@ } // 0-9 adds another 'digit' to the repeat number - if (repeat && Character.isDigit(c)) { + if (isRepeatEnabled() && Character.isDigit(c)) { repeatCount *= 10; repeatCount += c - '0'; return; @@ -241,7 +241,7 @@ executeAction(INSERT_CHAR, e.getSource(), String.valueOf(e.getKeyChar())); repeatCount = 0; - repeat = false; + setRepeatEnabled(false); } } } Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2008-07-22 21:06:34 UTC (rev 4391) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/InputHandler.java 2008-07-23 11:46:47 UTC (rev 4392) @@ -216,7 +216,7 @@ @Nullable protected ActionListener grabAction; - protected boolean repeat; + private boolean repeat; protected int repeatCount; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 16:33:38
|
Revision: 4394 http://gridarta.svn.sourceforge.net/gridarta/?rev=4394&view=rev Author: akirschbaum Date: 2008-07-23 16:33:44 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Rename field name. Modified Paths: -------------- trunk/daimonin/src/daieditor/map/validation/checks/ExitChecker.java trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/map/MapSquare.java trunk/src/app/net/sf/gridarta/map/validation/SquareValidationError.java Modified: trunk/daimonin/src/daieditor/map/validation/checks/ExitChecker.java =================================================================== --- trunk/daimonin/src/daieditor/map/validation/checks/ExitChecker.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/daimonin/src/daieditor/map/validation/checks/ExitChecker.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -57,7 +57,7 @@ newfile = new File(mapDirectory.getAbsolutePath(), path.substring(1)); } else { // we have a relative path: - newfile = new File(gameObject.getMapSquare().getModel().getMapControl().getMapFile().getParent(), path); + newfile = new File(gameObject.getMapSquare().getMapModel().getMapControl().getMapFile().getParent(), path); } if (!newfile.exists() || newfile.isDirectory()) { errorCollector.collect(new ExitError<GameObject, MapArchObject, Archetype>(gameObject, path)); Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -429,7 +429,7 @@ protected final void squareChanged() { final MapSquare<G, A, R> square = getMapSquare(); if (square != null) { - square.getModel().squareChanged(square); + square.getMapModel().squareChanged(square); } } Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -602,9 +602,9 @@ if (gameObject != null) { final MapSquare<G, A, R> mapSquare = gameObject.getHead().getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Add event script"); + mapSquare.getMapModel().beginTransaction("Add event script"); gameObject.getHead().addEventScript(eventList, this); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } @@ -628,9 +628,9 @@ if (index >= 0) { final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Modify event script"); + mapSquare.getMapModel().beginTransaction("Modify event script"); gameObject.getHead().modifyEventScript(index, task, eventList, this); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } } @@ -691,7 +691,7 @@ invnew.postParseGameObject(0); final MapSquare<G, A, R> mapSquare = inv.getMapSquare(); assert mapSquare != null; - final MapModel<G, A, R> mapModel = mapSquare.getModel(); + final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Add to inventory"); inv.addLast(invnew); invnew.setObjectFace(); @@ -716,7 +716,7 @@ final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Change object attributes"); + mapSquare.getMapModel().beginTransaction("Change object attributes"); // We update all panels: name, face, msg and archText (more to come...) // the obj name: @@ -772,7 +772,7 @@ gameObject.updateEditType(mapManager.getCurrentMap().getActiveEditType()); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } /** Create the arch panel entry of the lower window. */ Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -713,7 +713,7 @@ tilePanel.setOriginal(gameObject.getAttributeString(nameOld)); File relativeReference; if (dType == ArchAttribType.MAP_PATH) { - relativeReference = gameObject.getMapSquare().getModel().getMapControl().getMapFile(); + relativeReference = gameObject.getMapSquare().getMapModel().getMapControl().getMapFile(); if (relativeReference == null) { relativeReference = new File(mainControl.getGlobalSettings().getMapDir(), "dummy"); } @@ -1061,7 +1061,7 @@ private boolean applySettings() { final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); assert mapSquare != null; - final MapModel<G, A, R> mapModel = mapSquare.getModel(); + final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Change object attributes"); try { return applySettings2(); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -323,11 +323,11 @@ } } if (!gameObjectsToDelete.isEmpty()) { - mapSquare.getModel().beginTransaction("Delete Object"); + mapSquare.getMapModel().beginTransaction("Delete Object"); for (final G gameObjectToDelete : gameObjectsToDelete) { - mapSquare.getModel().deleteMapArch(gameObjectToDelete, true); + mapSquare.getMapModel().deleteMapArch(gameObjectToDelete, true); } - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -112,7 +112,7 @@ */ public boolean checkForChangedMapSquare(@NotNull final MapSquare<G, A, R> changedMapSquare) { final MapSquare<G, A, R> currentMapSquare = mapSquare; // copy for concurrency reasons - if (currentMapSquare == null || currentMapSquare.getModel() != changedMapSquare.getModel() || currentMapSquare.getMapX() != changedMapSquare.getMapX() || currentMapSquare.getMapY() != changedMapSquare.getMapY()) { + if (currentMapSquare == null || currentMapSquare.getMapModel() != changedMapSquare.getMapModel() || currentMapSquare.getMapX() != changedMapSquare.getMapX() || currentMapSquare.getMapY() != changedMapSquare.getMapY()) { return false; } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -103,9 +103,9 @@ if (arch != null) { final MapSquare<G, A, R> mapSquare = arch.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Move Top"); + mapSquare.getMapModel().beginTransaction("Move Top"); arch.moveTop(); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } @@ -116,9 +116,9 @@ if (arch != null) { final MapSquare<G, A, R> mapSquare = arch.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Move Up"); + mapSquare.getMapModel().beginTransaction("Move Up"); arch.moveUp(); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } @@ -129,9 +129,9 @@ if (arch != null) { final MapSquare<G, A, R> mapSquare = arch.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Move Down"); + mapSquare.getMapModel().beginTransaction("Move Down"); arch.moveDown(); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } @@ -142,9 +142,9 @@ if (arch != null) { final MapSquare<G, A, R> mapSquare = arch.getMapSquare(); assert mapSquare != null; - mapSquare.getModel().beginTransaction("Move Bottom"); + mapSquare.getMapModel().beginTransaction("Move Bottom"); arch.moveBottom(); - mapSquare.getModel().endTransaction(); + mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -503,7 +503,7 @@ log.warn("setSelectedGameObject: gameObject " + gameObject + " is not part of a map"); return; } - if (selectedMapTile.getMapView().getMapControl().getMapModel() != mapSquare.getModel()) { + if (selectedMapTile.getMapView().getMapControl().getMapModel() != mapSquare.getMapModel()) { return; } Modified: trunk/src/app/net/sf/gridarta/map/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -44,7 +44,7 @@ /** The MaoModel this square is associated with. */ @NotNull - private final MapModel<G, A, R> model; + private final MapModel<G, A, R> mapModel; /** The X Coordinate of this map square within the model's grid. */ private final int mapX; @@ -54,12 +54,12 @@ /** * Creates a new instance of MapSquare. - * @param model MapModel for this MapSquare + * @param mapModel MapModel for this MapSquare * @param mapX X Coordinate of this map square within the model's grid * @param mapY Y Coordinate of this map square within the model's grid */ - public MapSquare(@NotNull final MapModel<G, A, R> model, final int mapX, final int mapY) { - this.model = model; + public MapSquare(@NotNull final MapModel<G, A, R> mapModel, final int mapX, final int mapY) { + this.mapModel = mapModel; this.mapX = mapX; this.mapY = mapY; squareChanged(); @@ -70,8 +70,8 @@ * @return MapModel */ @NotNull - public MapModel<G, A, R> getModel() { - return model; + public MapModel<G, A, R> getMapModel() { + return mapModel; } /** {@inheritDoc} */ @@ -113,7 +113,7 @@ */ @SuppressWarnings({"ObjectEquality"}) public boolean isLocationEqual(@NotNull final MapSquare<G, A, R> mapSquare) { - return mapSquare.model == model && mapSquare.mapX == mapX && mapSquare.mapY == mapY; + return mapSquare.mapModel == mapModel && mapSquare.mapX == mapX && mapSquare.mapY == mapY; } /** Modified: trunk/src/app/net/sf/gridarta/map/validation/SquareValidationError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/SquareValidationError.java 2008-07-23 16:32:13 UTC (rev 4393) +++ trunk/src/app/net/sf/gridarta/map/validation/SquareValidationError.java 2008-07-23 16:33:44 UTC (rev 4394) @@ -38,7 +38,7 @@ * @param mapSquare the square on which the error occurred */ public SquareValidationError(final MapSquare<G, A, R> mapSquare) { - super(mapSquare.getModel()); + super(mapSquare.getMapModel()); this.mapSquare = mapSquare; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 17:01:39
|
Revision: 4396 http://gridarta.svn.sourceforge.net/gridarta/?rev=4396&view=rev Author: akirschbaum Date: 2008-07-23 17:01:46 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Add MapView field to MouseOpEvent. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -30,6 +30,7 @@ import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapUserListener; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -145,6 +146,12 @@ } /** {@inheritDoc} */ + @Override + public void init(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { + mapUserListener.init(mapView); + } + + /** {@inheritDoc} */ public void closeNotify() { super.closeNotify(); getMapCursor().removeMapCursorListener(mapCursorListener); Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -30,6 +30,7 @@ import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapUserListener; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -147,6 +148,12 @@ } /** {@inheritDoc} */ + @Override + public void init(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { + mapUserListener.init(mapView); + } + + /** {@inheritDoc} */ public void closeNotify() { super.closeNotify(); getMapCursor().removeMapCursorListener(mapCursorListener); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -55,17 +55,21 @@ private final Point tmpPoint = new Point(); - @NotNull - private final MouseOpEvent<G, A, R, V> mouseOpEvent = new MouseOpEvent<G, A, R, V>(); + /*XXX:@NotNull*/ + private MouseOpEvent<G, A, R, V> mouseOpEvent = null; - public MapUserListener(final MapControl<G, A, R, V> mapControl, final V mapView, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final ToolPalette<G, A, R, V> toolPalette) { + public MapUserListener(final MapControl<G, A, R, V> mapControl, final V mapViewBasic, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final ToolPalette<G, A, R, V> toolPalette) { this.mapControl = mapControl; this.pickmapChooserControl = pickmapChooserControl; this.toolPalette = toolPalette; - mapCursor = mapView.getMapCursor(); - renderer = mapView.getRenderer(); + mapCursor = mapViewBasic.getMapCursor(); + renderer = mapViewBasic.getRenderer(); } + public void init(@NotNull final MapView<G, A, R, V> mapView) { + mouseOpEvent = new MouseOpEvent<G, A, R, V>(mapView); + } + /** {@inheritDoc} */ public void mouseClicked(final MouseEvent e) { final MouseOpListener<G, A, R, V> mouseOpListener = getMouseOperation(e); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -162,6 +162,7 @@ setAutoscrolls(true); updateFrameIcon(); setJMenuBar(actionFactory.createMenuBar(false, "mapwindow")); + view.init(this); } /** This function must be called when the view is closed. */ Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -109,6 +109,8 @@ getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); } + public abstract void init(@NotNull final MapView<G, A, R, V> mapView); + /** * Get MapGrid of this view. * @return MapGrid of this view. Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2008-07-23 16:42:37 UTC (rev 4395) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2008-07-23 17:01:46 UTC (rev 4396) @@ -24,9 +24,11 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; /** * A MouseOpEvent is an event triggered for a MouseOpListener. Note that @@ -38,6 +40,12 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; + /** + * The map view on which this event occurred. + */ + @NotNull + private final MapView<G, A, R, V> mapView; + /** The cursor to use for this event. */ private MapCursor mapCursor; @@ -70,10 +78,20 @@ private int clickCount; /** Create an empty MouseOpEvent. */ - public MouseOpEvent() { + public MouseOpEvent(@NotNull final MapView<G, A, R, V> mapView) { super(""); + this.mapView = mapView; } + /** + * Returns the map view on which this event occurred. + * @return the map view + */ + @NotNull + public MapView<G, A, R, V> getMapView() { + return mapView; + } + public Point getMapLocation() { return mapLocation; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 17:04:48
|
Revision: 4397 http://gridarta.svn.sourceforge.net/gridarta/?rev=4397&view=rev Author: akirschbaum Date: 2008-07-23 17:04:52 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Rename field name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/MapActions.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/CurrentMapListener.java trunk/src/app/net/sf/gridarta/gui/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/StatusBar.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -180,7 +180,7 @@ */ public boolean isGridVisible() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - return mapView != null && mapView.getView().getRenderer().isGridVisible(); + return mapView != null && mapView.getMapViewBasic().getRenderer().isGridVisible(); } /** @@ -193,7 +193,7 @@ public void setGridVisible(final boolean gridVisible) { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); if (mapView != null) { - mapView.getView().getRenderer().setGridVisible(gridVisible); + mapView.getMapViewBasic().getRenderer().setGridVisible(gridVisible); } } @@ -218,7 +218,7 @@ public void mapCreateView() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getCreateViewEnabled(); if (mapView != null) { - mapManager.mapCreateView(mapView.getMapControl(), mapView.getView().getViewPosition()); + mapManager.mapCreateView(mapView.getMapControl(), mapView.getMapViewBasic().getViewPosition()); } } @@ -346,7 +346,7 @@ if (!currentMap.getMapModel().isPointValid(destinationPoint)) { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitOutside"); } else { - currentMapView.getView().setCursorPosition(destinationPoint); + currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); } } return; @@ -404,9 +404,9 @@ destinationPoint.x = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); destinationPoint.y = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); } - newMapView.getView().setCursorPosition(destinationPoint); + newMapView.getMapViewBasic().setCursorPosition(destinationPoint); } else { - newMapView.getView().setViewPosition(calculateNewViewPosition(currentMapView.getView(), newMapView.getView(), direction)); + newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); } if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { @@ -477,7 +477,7 @@ return selectedExit.getHead(); } - final GameObject cursorExit = mapView.getMapControl().getMapModel().getExit(mapView.getView().getMapCursor().getLocation()); + final GameObject cursorExit = mapView.getMapControl().getMapModel().getExit(mapView.getMapViewBasic().getMapCursor().getLocation()); if (cursorExit != null && exitMatcher.isMatching(cursorExit) && cursorExit.getAttributeString("slaying").length() > 0) { return cursorExit.getHead(); } Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -176,7 +176,7 @@ */ public boolean isGridVisible() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - return mapView != null && mapView.getView().getRenderer().isGridVisible(); + return mapView != null && mapView.getMapViewBasic().getRenderer().isGridVisible(); } /** @@ -189,7 +189,7 @@ public void setGridVisible(final boolean gridVisible) { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); if (mapView != null) { - mapView.getView().getRenderer().setGridVisible(gridVisible); + mapView.getMapViewBasic().getRenderer().setGridVisible(gridVisible); } } @@ -214,7 +214,7 @@ public void mapCreateView() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getCreateViewEnabled(); if (mapView != null) { - mapManager.mapCreateView(mapView.getMapControl(), mapView.getView().getViewPosition()); + mapManager.mapCreateView(mapView.getMapControl(), mapView.getMapViewBasic().getViewPosition()); } } @@ -352,7 +352,7 @@ ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitNowhere"); } else if (currentMap.getMapModel().isPointValid(destinationPoint)) { - currentMapView.getView().setCursorPosition(destinationPoint); + currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); } else { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitOutside"); } @@ -389,9 +389,9 @@ destinationPoint.x = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); destinationPoint.y = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); } - newMapView.getView().setCursorPosition(destinationPoint); + newMapView.getMapViewBasic().setCursorPosition(destinationPoint); } else { - newMapView.getView().setViewPosition(calculateNewViewPosition(currentMapView.getView(), newMapView.getView(), direction)); + newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); } if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { @@ -462,7 +462,7 @@ return selectedExit.getHead(); } - final GameObject cursorExit = mapView.getMapControl().getMapModel().getExit(mapView.getView().getMapCursor().getLocation()); + final GameObject cursorExit = mapView.getMapControl().getMapModel().getExit(mapView.getMapViewBasic().getMapCursor().getLocation()); if (cursorExit != null && exitMatcher.isMatching(cursorExit) && cursorExit.getAttributeString("slaying").length() > 0) { return cursorExit.getHead(); } Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -266,7 +266,7 @@ getGlobalSettings().setImageDir(imageFile.getParentFile().getAbsolutePath()); if (!imageFile.exists() || ACTION_FACTORY.showConfirmDialog(getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", imageFile) == JOptionPane.YES_OPTION) { try { - mapView.getView().getRenderer().printFullImage(imageFile); + mapView.getMapViewBasic().getRenderer().printFullImage(imageFile); } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(getMainView(), "createImageIOException", imageFile, e.getMessage()); } @@ -284,7 +284,7 @@ public void createImageWanted(@NotNull final MapView<G, A, R, V> mapView, final File file) { final File tmpFile = new File(file.getPath() + ".tmp"); try { - mapView.getView().getRenderer().printFullImage(tmpFile); + mapView.getMapViewBasic().getRenderer().printFullImage(tmpFile); if (!tmpFile.renameTo(file)) { throw new IOException("cannot rename " + tmpFile + " to " + file); } Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -135,7 +135,7 @@ * @param copyMode defines if we have a cut, copy or paste action */ private void copyNCut(final MapView<G, A, R, V> mapView, final CopyMode copyMode) { - final Rectangle selRec = mapView.getView().getMapGrid().getSelectedRec(); + final Rectangle selRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); assert selRec != null; final MapModel<G, A, R> mapModel = copyMapCtrl.getMapModel(); @@ -150,7 +150,7 @@ mapView.getMapControl().getMapModel().beginTransaction("Cut / Clear"); // TODO: I18N/L10N final Set<G> gameObjectsToDelete = new HashSet<G>(); - for (final MapSquare<G, A, R> square : mapView.getView().getSelectedSquares()) { + for (final MapSquare<G, A, R> square : mapView.getMapViewBasic().getSelectedSquares()) { final int posx = square.getMapX(); final int posy = square.getMapY(); for (final G gameObject : square) { @@ -189,7 +189,7 @@ * @todo paste only subregions when a region is selected */ public void paste(final MapView<G, A, R, V> mapView) { - final Point startp = mapView.getView().getMapCursor().getLocation(); + final Point startp = mapView.getMapViewBasic().getMapCursor().getLocation(); assert startp != null; final MapControl<G, A, R, V> mapControl = mapView.getMapControl(); @@ -230,7 +230,7 @@ * @param density the fill density in percent; -1 to disable */ public void fill(final MapView<G, A, R, V> mapView, final InsertionMode insertionMode, final MapView<G, A, R, V> seed, final int density) { - if (mapView.getView().getMapGrid().getSelectedRec() == null) { + if (mapView.getMapViewBasic().getMapGrid().getSelectedRec() == null) { return; // should actually never happen } @@ -245,7 +245,7 @@ } mapView.getMapControl().getMapModel().beginTransaction("Fill"); // TODO; I18N/L10N - for (final Point p : mapView.getView().getSelection()) { + for (final Point p : mapView.getMapViewBasic().getSelection()) { if (density != -1 && density != 100 && density < MainControl.rnd.nextInt(100) + 1) { continue; } @@ -260,7 +260,7 @@ * @param mapView the map view to fill */ public void floodfill(@NotNull final MapView<G, A, R, V> mapView) { - final V mapViewBasic = mapView.getView(); + final V mapViewBasic = mapView.getMapViewBasic(); final Point cursor = mapViewBasic.getMapCursor().getLocation(); if (cursor == null) { return; Modified: trunk/src/app/net/sf/gridarta/CurrentMapListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/CurrentMapListener.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/CurrentMapListener.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -140,11 +140,11 @@ /** {@inheritDoc} */ public void currentMapViewChanged(@Nullable final MapView<G, A, R, V> mapView) { if (trackMapCursor && currentMapView != null) { - currentMapView.getView().removeMapCursorListener(mapCursorListener); + currentMapView.getMapViewBasic().removeMapCursorListener(mapCursorListener); } currentMapView = mapView; if (trackMapCursor && currentMapView != null) { - currentMapView.getView().addMapCursorListener(mapCursorListener); + currentMapView.getMapViewBasic().addMapCursorListener(mapCursorListener); } mapViewHasChanged(); } @@ -206,7 +206,7 @@ } } if (trackMapCursor && currentMapView != null) { - currentMapView.getView().addMapCursorListener(mapCursorListener); + currentMapView.getMapViewBasic().addMapCursorListener(mapCursorListener); } } @@ -222,7 +222,7 @@ currentMap.removeMapControlListener(mapControlListener); } if (trackMapCursor && currentMapView != null) { - currentMapView.getView().removeMapCursorListener(mapCursorListener); + currentMapView.getMapViewBasic().removeMapCursorListener(mapCursorListener); } } Modified: trunk/src/app/net/sf/gridarta/gui/ErrorListView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ErrorListView.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/ErrorListView.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -227,12 +227,12 @@ final G gameObject = error.getGameObject(); if (gameObject != null) { final G topContainer = gameObject.getTopContainer(); - currentMapControl.getMapViewFrame().getView().getMapCursor().setLocation(new Point(topContainer.getMapX(), topContainer.getMapY())); + currentMapControl.getMapViewFrame().getMapViewBasic().getMapCursor().setLocation(new Point(topContainer.getMapX(), topContainer.getMapY())); selectedSquareView.setSelectedGameObject(gameObject); } else { final MapSquare<G, A, R> mapSquare = error.getMapSquare(); final Point location = mapSquare == null ? null : new Point(mapSquare.getMapX(), mapSquare.getMapY()); - currentMapControl.getMapViewFrame().getView().getMapCursor().setLocation(location); + currentMapControl.getMapViewFrame().getMapViewBasic().getMapCursor().setLocation(location); } errorMsg.setCaretPosition(0); } Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -191,8 +191,8 @@ /** {@inheritDoc} */ public void mapViewCreated(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().addMapGridListener(mapGridListener); - mapView.getView().addMapCursorListener(mapCursorListener); + mapView.getMapViewBasic().addMapGridListener(mapGridListener); + mapView.getMapViewBasic().addMapCursorListener(mapCursorListener); } /** {@inheritDoc} */ @@ -202,8 +202,8 @@ /** {@inheritDoc} */ public void mapViewClosing(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().removeMapCursorListener(mapCursorListener); - mapView.getView().removeMapGridListener(mapGridListener); + mapView.getMapViewBasic().removeMapCursorListener(mapCursorListener); + mapView.getMapViewBasic().removeMapGridListener(mapGridListener); } }; @@ -750,7 +750,7 @@ */ @Nullable private MapGrid getSelectAllEnabled() { - return currentMapView != null ? currentMapView.getView().getMapGrid() : null; + return currentMapView != null ? currentMapView.getMapViewBasic().getMapGrid() : null; } /** @@ -779,7 +779,7 @@ */ @Nullable private MapView<G, A, R, V> getSelection() { - return currentMapView != null && currentMapView.getView().getMapGrid().getSelectedRec() != null ? currentMapView : null; + return currentMapView != null && currentMapView.getMapViewBasic().getMapGrid().getSelectedRec() != null ? currentMapView : null; } /** @@ -788,7 +788,7 @@ */ @Nullable private MapView<G, A, R, V> getCursor() { - return currentMapView != null && currentMapView.getView().getMapCursor().isActive() ? currentMapView : null; + return currentMapView != null && currentMapView.getMapViewBasic().getMapCursor().isActive() ? currentMapView : null; } } // class MainActions Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -141,7 +141,7 @@ line1.add(labelon); line1.add(Box.createVerticalStrut(3)); replaceEntireBox = new JComboBox(new String[] {ACTION_FACTORY.getString("replaceOnMap"), ACTION_FACTORY.getString("replaceOnSelection")}); - if (mapView.getView().getSelectedSquares().size() > 1) { + if (mapView.getMapViewBasic().getSelectedSquares().size() > 1) { replaceEntireBox.setSelectedIndex(1); } else { replaceEntireBox.setSelectedIndex(0); @@ -239,7 +239,7 @@ colonLabel.setText(":"); } - if (mapView.getView().getSelectedSquares().size() > 1) { + if (mapView.getMapViewBasic().getSelectedSquares().size() > 1) { replaceEntireBox.setSelectedIndex(1); // selected squares } else { replaceEntireBox.setSelectedIndex(0); // entire map @@ -323,7 +323,7 @@ final MapControl<G, A, R, V> mapControl = mapView.getMapControl(); mapControl.getMapModel().beginTransaction("Replace"); // TODO: I18N/L10N int replaceCount = 0; - for (final MapSquare<G, A, R> square : entireMap ? mapControl.getMapModel() : mapView.getView().getSelectedSquares()) { + for (final MapSquare<G, A, R> square : entireMap ? mapControl.getMapModel() : mapView.getMapViewBasic().getSelectedSquares()) { // Operate on a copy of the nodes to prevent ConcurrentModificationException // find objects to replace @@ -455,7 +455,7 @@ ACTION_FACTORY.showMessageDialog(this, "replaceMapGone", mapView.getMapControl().getMapFileName()); return true; } else - if (!entireMap && mapView.getView().getMapGrid().getSelectedRec() == null) { + if (!entireMap && mapView.getMapViewBasic().getMapGrid().getSelectedRec() == null) { // user selected "replace highlighted" but nothing is highlighted ACTION_FACTORY.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapFileName()); return false; Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -87,7 +87,7 @@ * @return Whether shifting is possible. */ public boolean canShift(final int dir) { - mapGrid = mapView.getView().getMapGrid(); + mapGrid = mapView.getMapViewBasic().getMapGrid(); selRec = mapGrid.getSelectedRec(); if (selRec == null) { return false; Modified: trunk/src/app/net/sf/gridarta/gui/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -309,16 +309,16 @@ private void setCurrentMapView(@Nullable final MapView<G, A, R, V> mapView) { if (this.mapView != null) { - this.mapView.getView().getMapCursor().removeMapCursorListener(mapCursorListener); + this.mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); } this.mapView = mapView; if (this.mapView != null) { - this.mapView.getView().getMapCursor().addMapCursorListener(mapCursorListener); + this.mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); } - mapCursorChanged(mapView == null ? null : mapView.getView().getMapCursor()); + mapCursorChanged(mapView == null ? null : mapView.getMapViewBasic().getMapCursor()); } } // class StatusBar Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -82,7 +82,7 @@ return; } - final MapGrid mapGrid = mapView.getView().getMapGrid(); + final MapGrid mapGrid = mapView.getMapViewBasic().getMapGrid(); mapGrid.unSelect(); final Point point = new Point(); Modified: trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -121,7 +121,7 @@ gbcField.gridwidth = GridBagConstraints.REMAINDER; coordinatesPanel.setBorder(new CompoundBorder(new TitledBorder(new EtchedBorder()), GUIConstants.DIALOG_BORDER)); - final Point point = mapView.getView().getMapCursor().getLocation(); + final Point point = mapView.getMapViewBasic().getMapCursor().getLocation(); coordinatesPanel.add(new JLabel(ACTION_FACTORY.getString("goLocationX")), gbcLabel); xCoordinateField.setValue(point == null ? 0 : point.x); @@ -170,7 +170,7 @@ return false; } - mapView.getView().getMapCursor().setLocation(point); + mapView.getMapViewBasic().getMapCursor().setLocation(point); return true; } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -106,7 +106,7 @@ /** {@inheritDoc} */ public void mapViewCreated(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().addMapCursorListener(mapCursorListener); + mapView.getMapViewBasic().addMapCursorListener(mapCursorListener); } /** {@inheritDoc} */ @@ -116,7 +116,7 @@ /** {@inheritDoc} */ public void mapViewClosing(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().removeMapCursorListener(mapCursorListener); + mapView.getMapViewBasic().removeMapCursorListener(mapCursorListener); } }; @@ -454,7 +454,7 @@ */ @Nullable private MapCursor getMapCursor() { - return mapView != null ? mapView.getView().getMapCursor() : null; + return mapView != null ? mapView.getMapViewBasic().getMapCursor() : null; } /** Enable/disable menu entries based on the current cursor state. */ Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -67,7 +67,7 @@ /** The underlying mapview object. */ @NotNull - private final V view; + private final V mapViewBasic; /** The map file actions for this map. */ @Nullable @@ -143,32 +143,32 @@ * @param mainControl The main control. * @param mapControl the controller of this view * @param number Each view of a level will get a number - * @param view The underlying mapview object. + * @param mapViewBasic The underlying mapview object. * @param actionFactory Action Factory to create Actions. */ - public MapView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapControl<G, A, R, V> mapControl, final int number, @NotNull final V view, @NotNull final ActionFactory actionFactory) { + public MapView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapControl<G, A, R, V> mapControl, final int number, @NotNull final V mapViewBasic, @NotNull final ActionFactory actionFactory) { super(PathManager.getMapPath(mapControl.getMapFileName()) + " [ " + mapControl.getMapModel().getMapArchObject().getMapDisplayName() + " ] (" + number + ")" + (mapControl.isModified() ? " *" : ""), true, true, true, true); this.mainControl = mainControl; this.mapControl = mapControl; this.number = number; - this.view = view; + this.mapViewBasic = mapViewBasic; mapFileActions = null;//new MapFileActions<G, A, R, C, V>(mainControl, mapControl); // XXX: uncomment this after JAPI can create multiple action sets windowAction = new WindowAction<G, A, R, V>(mainControl, this); mapControl.getMapModel().addMapModelListener(mapModelListener); mapControl.addMapControlListener(mapControlListener); getContentPane().setLayout(new BorderLayout()); - getContentPane().add(view, BorderLayout.CENTER); + getContentPane().add(mapViewBasic, BorderLayout.CENTER); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setAutoscrolls(true); updateFrameIcon(); setJMenuBar(actionFactory.createMenuBar(false, "mapwindow")); - view.init(this); + mapViewBasic.init(this); } /** This function must be called when the view is closed. */ public void closeNotify() { - getContentPane().remove(view); - view.closeNotify(); + getContentPane().remove(mapViewBasic); + mapViewBasic.closeNotify(); mapControl.removeMapControlListener(mapControlListener); mapControl.getMapModel().removeMapModelListener(mapModelListener); //mapFileActions.closeNotify(); @@ -202,7 +202,7 @@ */ @NotNull public List<G> getSelectedGameObjects() { - final List<MapSquare<G, A, R>> selectedMapSquares = getView().getSelectedSquares(); + final List<MapSquare<G, A, R>> selectedMapSquares = getMapViewBasic().getSelectedSquares(); if (selectedMapSquares.isEmpty()) { return getMapControl().getAllGameObjects(); } @@ -252,8 +252,8 @@ * @return the associated <code>MapViewBasic</code> */ @NotNull - public V getView() { - return view; + public V getMapViewBasic() { + return mapViewBasic; } /** Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -133,7 +133,7 @@ */ @Nullable public synchronized V getView() { - return pickmapView.getView(); + return pickmapView.getMapViewBasic(); } /** Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -66,7 +66,7 @@ currentPickmapActions.setCurrentPickmap(pickmap); final MapControl<G, A, R, V> mapControl = pickmap == null ? null : pickmap.getPickmap(); if (mapControl != null) { - mapControl.getMapViewFrame().getView().unHighlight(); + mapControl.getMapViewFrame().getMapViewBasic().unHighlight(); } for (final PickmapChooserListener listener : listeners) { listener.activePickmapChanged(); Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -173,7 +173,7 @@ /** {@inheritDoc} */ public void mapViewCreated(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().addMapCursorListener(SelectedSquareView.this); + mapView.getMapViewBasic().addMapCursorListener(SelectedSquareView.this); } /** {@inheritDoc} */ @@ -183,7 +183,7 @@ /** {@inheritDoc} */ public void mapViewClosing(@NotNull final MapView<G, A, R, V> mapView) { - mapView.getView().removeMapCursorListener(SelectedSquareView.this); + mapView.getMapViewBasic().removeMapCursorListener(SelectedSquareView.this); final MapTileSelection<G, A, R, V> closedMapTile = mapTileSelectionCache.find(mapView); if (selectedMapTile != null && selectedMapTile == closedMapTile) { Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-23 17:01:46 UTC (rev 4396) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-23 17:04:52 UTC (rev 4397) @@ -343,7 +343,7 @@ public Point[] getViewPositions() { final Point[] result = new Point[mapViews.size()]; for (int i = 0; i < result.length; i++) { - result[i] = mapViews.get(i).getView().getViewPosition(); + result[i] = mapViews.get(i).getMapViewBasic().getViewPosition(); } return result; } @@ -460,7 +460,7 @@ /** {@inheritDoc} */ public void repaint() { for (final MapView<G, A, R, V> mapView : getMapViewFrames()) { - mapView.getView().getRenderer().forceRepaint(); + mapView.getMapViewBasic().getRenderer().forceRepaint(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 17:25:59
|
Revision: 4398 http://gridarta.svn.sourceforge.net/gridarta/?rev=4398&view=rev Author: akirschbaum Date: 2008-07-23 17:26:04 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Move code to check for locked pickmaps to InsertionTool/DeletionTool. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -248,7 +248,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -43,7 +43,6 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; @@ -76,10 +75,6 @@ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; - /** The {@link PickmapChooserControl} instance to use. */ - @NotNull - private PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl = null; - /** The {@link SelectedSquareView} instance to use. */ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; @@ -143,15 +138,14 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects, pickmapChooserControl, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; - this.pickmapChooserControl = pickmapChooserControl; this.selectedSquareView = selectedSquareView; } Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -33,7 +33,6 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -121,13 +120,12 @@ * @param initial the initial view position to show; null=show top left * corner * @param faceObjects the FaceObjects instance to use - * @param pickmapChooserControl the pickmap chooser control * @param toolPalette the tool palette * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param selectedSquareView the selected square view */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); getMapCursor().addMapCursorListener(mapCursorListener); @@ -136,7 +134,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, pickmapChooserControl, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, toolPalette); renderer.addMouseListener(mapUserListener); renderer.addMouseMotionListener(mapUserListener); renderer.setErroneousMapSquares(erroneousMapSquares); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -301,7 +301,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -43,7 +43,6 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; @@ -76,10 +75,6 @@ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; - /** The {@link PickmapChooserControl} instance to use. */ - @NotNull - private PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl = null; - /** The {@link SelectedSquareView} instance to use. */ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; @@ -145,15 +140,14 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects, pickmapChooserControl, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; - this.pickmapChooserControl = pickmapChooserControl; this.selectedSquareView = selectedSquareView; } Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -33,7 +33,6 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -123,13 +122,12 @@ * @param initial the initial view position to show; null=show top left * corner * @param faceObjects the FaceObjects instance to use - * @param pickmapChooserControl the pickmap chooser control * @param toolPalette the tool palette * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param selectedSquareView the selected square view */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); getMapCursor().addMapCursorListener(mapCursorListener); @@ -138,7 +136,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, pickmapChooserControl, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, toolPalette); renderer.addMouseListener(mapUserListener); renderer.addMouseMotionListener(mapUserListener); renderer.setErroneousMapSquares(erroneousMapSquares); Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -32,7 +32,6 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; @@ -137,9 +136,8 @@ * @param faceObjects the FaceObjects instance * @param objectChooser the ObjectChooser instance * @param archetypeChooserControl the ArchetypeChooserControl instance - * @param pickmapChooserControl the pickmap chooser control instance * @param selectedSquareView the selected square view instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -109,7 +109,7 @@ // ignore } }); - toolPalette = new ToolPalette<G, A, R, V>(mainControl, selectedSquareView, this); + toolPalette = new ToolPalette<G, A, R, V>(mainControl, selectedSquareView, this, pickmapChooserControl); objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, this); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map; import java.awt.Point; -import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -29,7 +28,6 @@ import net.sf.gridarta.gui.map.event.MouseOpEvent; import net.sf.gridarta.gui.map.event.MouseOpListener; import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; @@ -50,17 +48,13 @@ private final MapControl<G, A, R, V> mapControl; - @NotNull - private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; - private final Point tmpPoint = new Point(); /*XXX:@NotNull*/ private MouseOpEvent<G, A, R, V> mouseOpEvent = null; - public MapUserListener(final MapControl<G, A, R, V> mapControl, final V mapViewBasic, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final ToolPalette<G, A, R, V> toolPalette) { + public MapUserListener(final MapControl<G, A, R, V> mapControl, final V mapViewBasic, @NotNull final ToolPalette<G, A, R, V> toolPalette) { this.mapControl = mapControl; - this.pickmapChooserControl = pickmapChooserControl; this.toolPalette = toolPalette; mapCursor = mapViewBasic.getMapCursor(); renderer = mapViewBasic.getRenderer(); @@ -117,12 +111,6 @@ /** {@inheritDoc} */ public void mousePressed(final MouseEvent e) { - // XXX: this is the wrong place to check for locked pickmaps - // in "locked pickmaps" mode, pickmaps react only to leftclicks - assert mapControl != null; - if (mapControl.isPickmap() && pickmapChooserControl.isLockAllPickmaps() && !(e.getModifiers() == InputEvent.BUTTON1_MASK && !e.isShiftDown() && !e.isControlDown())) { - return; - } final MouseOpListener<G, A, R, V> mouseOpListener = getMouseOperation(e); if (mouseOpListener != null) { mouseOpListener.pressed(mouseOpEvent); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -35,6 +35,7 @@ import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; @@ -128,6 +129,10 @@ @NotNull private final ObjectChooser<G, A, R> objectChooser; + /** The PickmapChooserControl to use. */ + @NotNull + private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + /** * The action for "ignore walls". */ @@ -172,11 +177,13 @@ * Create a DeletionTool. * @param mainControl the main control * @param objectChooser the object chooser to use + * @param pickmapChooserControl the pickmap chooser control to use */ - public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super("deletion"); this.mainControl = mainControl; this.objectChooser = objectChooser; + this.pickmapChooserControl = pickmapChooserControl; } /** @@ -222,6 +229,10 @@ * @param mapControl map control of map to delete arch from */ private void deleteArch(final Point mapLoc, final MapControl<G, A, R, V> mapControl) { + if (mapControl.isPickmap() && pickmapChooserControl.isLockAllPickmaps()) { + return; + } + final MapSquare<G, A, R> mapSquare = mapControl.getMapModel().getMapSquare(mapLoc); final int scopeType = scopeComboBox.getSelectedIndex(); final int deleteType = deleteComboBox.getSelectedIndex(); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -31,6 +31,7 @@ import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.InsertionMode; @@ -89,15 +90,21 @@ @NotNull private final ObjectChooser<G, A, R> objectChooser; + /** The PickmapChooserControl to use. */ + @NotNull + private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + /** * Create a BasicAbstractTool. * @param selectedSquareView the selected square view * @param objectChooser the ObjectChooser to use + * @param pickmapChooserControl the pickmap chooser control to use */ - public InsertionTool(@NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public InsertionTool(@NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super("insertion"); this.selectedSquareView = selectedSquareView; this.objectChooser = objectChooser; + this.pickmapChooserControl = pickmapChooserControl; } /** {@inheritDoc} */ @@ -119,9 +126,13 @@ * dragged (<code>false</code>) */ private void doInsert(final MouseOpEvent<G, A, R, V> e, final boolean isPressed) { + final MapControl<G, A, R, V> mapControl = e.getMapControl(); + if (mapControl.isPickmap() && pickmapChooserControl.isLockAllPickmaps()) { + return; + } + final Point p = e.getMapLocation(); final MapCursor mapCursor = e.getMapCursor(); - final MapControl<G, A, R, V> mapControl = e.getMapControl(); if (isPressed) { if (p == null) { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -31,6 +31,7 @@ import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -68,12 +69,13 @@ * net.sf.gridarta.gui.map.tools.InsertionTool}). * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use + * @param pickmapChooserControl the pickmap chooser control to use */ - public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, selectedSquareView, objectChooser); + lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); add(new JLabel(ACTION_FACTORY.getString("mouse")), BorderLayout.NORTH); mouseTabs.add(ACTION_FACTORY.getString("left"), lmbSelector); mouseTabs.add(ACTION_FACTORY.getString("middle"), mmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-23 17:04:52 UTC (rev 4397) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-23 17:26:04 UTC (rev 4398) @@ -37,6 +37,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -90,10 +91,11 @@ * InsertionTool}). * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use + * @param pickmapChooserControl the pickmap chooser control to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { createUI(); - for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl, objectChooser), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser)}) { + for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 17:32:43
|
Revision: 4399 http://gridarta.svn.sourceforge.net/gridarta/?rev=4399&view=rev Author: akirschbaum Date: 2008-07-23 17:32:51 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 17:26:04 UTC (rev 4398) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-23 17:32:51 UTC (rev 4399) @@ -134,7 +134,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, toolPalette); renderer.addMouseListener(mapUserListener); renderer.addMouseMotionListener(mapUserListener); renderer.setErroneousMapSquares(erroneousMapSquares); Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 17:26:04 UTC (rev 4398) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-07-23 17:32:51 UTC (rev 4399) @@ -136,7 +136,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapControl, this, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, toolPalette); renderer.addMouseListener(mapUserListener); renderer.addMouseMotionListener(mapUserListener); renderer.setErroneousMapSquares(erroneousMapSquares); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 17:26:04 UTC (rev 4398) +++ trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-07-23 17:32:51 UTC (rev 4399) @@ -29,7 +29,6 @@ import net.sf.gridarta.gui.map.event.MouseOpListener; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -46,15 +45,12 @@ private final LevelRenderer renderer; - private final MapControl<G, A, R, V> mapControl; - private final Point tmpPoint = new Point(); /*XXX:@NotNull*/ private MouseOpEvent<G, A, R, V> mouseOpEvent = null; - public MapUserListener(final MapControl<G, A, R, V> mapControl, final V mapViewBasic, @NotNull final ToolPalette<G, A, R, V> toolPalette) { - this.mapControl = mapControl; + public MapUserListener(final V mapViewBasic, @NotNull final ToolPalette<G, A, R, V> toolPalette) { this.toolPalette = toolPalette; mapCursor = mapViewBasic.getMapCursor(); renderer = mapViewBasic.getRenderer(); @@ -79,7 +75,6 @@ mouseOpEvent.setMapCursor(mapCursor); mouseOpEvent.setModifiers(event.getModifiersEx()); mouseOpEvent.setClickCount(event.getClickCount()); - mouseOpEvent.setMapControl(mapControl); event.consume(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2008-07-23 17:26:04 UTC (rev 4398) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2008-07-23 17:32:51 UTC (rev 4399) @@ -50,7 +50,8 @@ private MapCursor mapCursor; /** The map control for this event. */ - private MapControl<G, A, R, V> mapControl; + @NotNull + private final MapControl<G, A, R, V> mapControl; /** The location of the point on the map model. */ private Point mapLocation; @@ -81,6 +82,7 @@ public MouseOpEvent(@NotNull final MapView<G, A, R, V> mapView) { super(""); this.mapView = mapView; + mapControl = mapView.getMapControl(); } /** @@ -140,14 +142,11 @@ this.clickCount = clickCount; } + @NotNull public MapControl<G, A, R, V> getMapControl() { return mapControl; } - public void setMapControl(final MapControl<G, A, R, V> mapControl) { - this.mapControl = mapControl; - } - /** * Get event type. * @return Return event type This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 19:20:36
|
Revision: 4402 http://gridarta.svn.sourceforge.net/gridarta/?rev=4402&view=rev Author: akirschbaum Date: 2008-07-23 19:20:42 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Implement #1712767 (New insertion tool: Box Insert). Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/crossfire/ChangeLog 2008-07-23 19:20:42 UTC (rev 4402) @@ -1,3 +1,7 @@ +2008-07-23 Andreas Kirschbaum <xxx> + + * Implement #1712767 (New insertion tool: Box Insert). + 2008-07-22 Andreas Kirschbaum * Add more options to insertion tool. Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -246,7 +246,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/daimonin/ChangeLog 2008-07-23 19:20:42 UTC (rev 4402) @@ -1,3 +1,7 @@ +2008-07-23 Andreas Kirschbaum <xxx> + + * Implement #1712767 (New insertion tool: Box Insert). + 2008-07-22 Andreas Kirschbaum * Add more options to insertion tool. Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -299,7 +299,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -27,6 +27,7 @@ import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; +import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -93,8 +94,9 @@ * Creates a new instance. * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control + * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; @@ -109,7 +111,7 @@ // ignore } }); - toolPalette = new ToolPalette<G, A, R, V>(mainControl, selectedSquareView, this, pickmapChooserControl); + toolPalette = new ToolPalette<G, A, R, V>(mainControl, selectedSquareView, this, pickmapChooserControl, copyBuffer); objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, this); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -19,8 +19,14 @@ package net.sf.gridarta.gui.map.tools; +import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.Point; import java.awt.event.InputEvent; +import javax.swing.JComboBox; +import javax.swing.JPanel; +import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.ObjectChooser; @@ -28,9 +34,14 @@ import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.undo.SwingUtils; +import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ToggleAction; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Tool for Selection. @@ -38,17 +49,70 @@ */ public class SelectionTool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends BasicAbstractTool<G, A, R, V> { + /** + * Index into {@link #modeComboBox}: guess insertion location. + */ + private static final int MODE_AUTO = 0; + + /** + * Index into {@link #modeComboBox}: insert topmost. + */ + private static final int MODE_TOPMOST = 1; + + /** + * Index into {@link #modeComboBox}: insert above floor. + */ + private static final int MODE_ABOVE_FLOOR = 2; + + /** + * Index into {@link #modeComboBox}: insert below floor. + */ + private static final int MODE_BELOW_FLOOR = 3; + + /** + * Index into {@link #modeComboBox}: insert bottommost. + */ + private static final int MODE_BOTTOMMOST = 4; + + /** Action Factory. */ + @NotNull + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta.gui.map.tools"); + + /** + * The action for "ignore walls". + */ + private final ToggleAction autoFillAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "selectionToolAutoFill", this); + + /** + * The {@link JComboBox} for selecting the insertion mode. + */ + private final JComboBox modeComboBox = createModeComboBox(); + /** The object chooser to update. */ @NotNull private final ObjectChooser<G, ?, ?> objectChooser; /** + * The copy buffer instance to use. + */ + @NotNull + private final CopyBuffer<G, A, R, V> copyBuffer; + + /** + * Whether auto-fill is enabled. + */ + private boolean selectionToolAutoFill = false; + + /** * Create a BasicAbstractTool. * @param objectChooser the object chooser to update + * @param copyBuffer the copy buffer instance to use */ - public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser) { + public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super("selection"); this.objectChooser = objectChooser; + this.copyBuffer = copyBuffer; + selectionToolAutoFillChanged(); } /** {@inheritDoc} */ @@ -99,6 +163,106 @@ } else { mapCursor.dragRelease(); } + + if (selectionToolAutoFill) { + final int modeIndex = modeComboBox.getSelectedIndex(); + final InsertionMode insertionMode; + switch (modeIndex) { + case MODE_AUTO: + insertionMode = InsertionMode.AUTO; + break; + + case MODE_TOPMOST: + insertionMode = InsertionMode.TOPMOST; + break; + + case MODE_ABOVE_FLOOR: + insertionMode = InsertionMode.ABOVE_FLOOR; + break; + + case MODE_BELOW_FLOOR: + insertionMode = InsertionMode.BELOW_FLOOR; + break; + + case MODE_BOTTOMMOST: + insertionMode = InsertionMode.BOTTOMMOST; + break; + + default: + throw new AssertionError(); + } + copyBuffer.fill(e.getMapView(), insertionMode, null, -1); + } } + /** {@inheritDoc} */ + @Override + @Nullable + public Component createOptionsView() { + final JPanel panel = new JPanel(); + panel.setLayout(new GridBagLayout()); + + final GridBagConstraints gbcLabel = new GridBagConstraints(); + gbcLabel.anchor = GridBagConstraints.EAST; + + final GridBagConstraints gbcComboBox = new GridBagConstraints(); + gbcComboBox.fill = GridBagConstraints.HORIZONTAL; + gbcComboBox.weightx = 1; + gbcComboBox.gridwidth = GridBagConstraints.REMAINDER; + + final GridBagConstraints gbcCheckBox = new GridBagConstraints(); + gbcCheckBox.fill = GridBagConstraints.HORIZONTAL; + gbcCheckBox.gridwidth = GridBagConstraints.REMAINDER; + + panel.add(autoFillAction.createCheckBox(), gbcCheckBox); + panel.add(SwingUtils.createLabel("selectionTool.mode", modeComboBox), gbcLabel); + panel.add(modeComboBox, gbcComboBox); + return panel; + } + + /** + * Create a {@link JComboBox} for selecting the scope to delete. + * @return the combo box + */ + private static JComboBox createModeComboBox() { + final String[] options = new String[] { + ACTION_FACTORY.getString("selectionTool.mode.auto"), + ACTION_FACTORY.getString("selectionTool.mode.topmost"), + ACTION_FACTORY.getString("selectionTool.mode.aboveFloor"), + ACTION_FACTORY.getString("selectionTool.mode.belowFloor"), + ACTION_FACTORY.getString("selectionTool.mode.bottommost"), + }; + final JComboBox comboBox = new JComboBox(options); + comboBox.setToolTipText(ACTION_FACTORY.getString("selectionTool.mode.shortdescription")); + return comboBox; + } + + /** + * Returns whether auto-fill is enabled. + * @return whether auto-fill is enabled + */ + public boolean isSelectionToolAutoFill() { + return selectionToolAutoFill; + } + + /** + * Sets whether auto-fill is enabled. + * @param selectionToolAutoFill whether auto-fill is enabled + */ + public void setSelectionToolAutoFill(final boolean selectionToolAutoFill) { + if (this.selectionToolAutoFill == selectionToolAutoFill) { + return; + } + this.selectionToolAutoFill = selectionToolAutoFill; + selectionToolAutoFillChanged(); + } + + /** + * Updates the GUI state to reflect the current {@link + * #selectionToolAutoFill} state. + */ + private void selectionToolAutoFillChanged() { + modeComboBox.setEnabled(selectionToolAutoFill); + } + } // class SelectionTool Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -25,6 +25,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; +import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -70,12 +71,13 @@ * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use + * @param copyBuffer the copy buffer instance to use */ - public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl); + lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); add(new JLabel(ACTION_FACTORY.getString("mouse")), BorderLayout.NORTH); mouseTabs.add(ACTION_FACTORY.getString("left"), lmbSelector); mouseTabs.add(ACTION_FACTORY.getString("middle"), mmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-23 19:20:42 UTC (rev 4402) @@ -32,6 +32,7 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.JToggleButton; +import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -92,10 +93,11 @@ * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use + * @param copyBuffer the copy buffer instance to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { createUI(); - for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser), new DeletionTool<G, A, R, V>(mainControl, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { + for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser, copyBuffer), new DeletionTool<G, A, R, V>(mainControl, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action.properties 2008-07-23 19:20:42 UTC (rev 4402) @@ -30,6 +30,16 @@ right=right mouse=Mousebutton +selectionToolAutoFill.text=Auto-fill selection +selectionToolAutoFill.shortdescription=Automatically fill the selected area. +selectionTool.mode.text=Mode: +selectionTool.mode.shortdescription=<html>Selects the insertion mode:<br>auto=guess insertion point depending on object type<br>topmost=insert above existing objects<br>above floor=insert right above floor<br>below floor=insert right below floor<br>bottom=insert below existing objects +selectionTool.mode.auto=auto +selectionTool.mode.topmost=topmost +selectionTool.mode.aboveFloor=above floor +selectionTool.mode.belowFloor=below floor +selectionTool.mode.bottommost=bottommost + deletionTool.delete.text=Delete: deletionTool.delete.shortdescription=<html>Selects the objects to delete:<br>topmost object=only the topmost object in scope<br>all=all objects in scope<br>bottommost object=only the bottommost object in scope deletionTool.delete.top=topmost object Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_de.properties 2008-07-23 19:20:42 UTC (rev 4402) @@ -26,6 +26,16 @@ right=rechts mouse=Maustaste +selectionToolAutoFill.text=Auswahl automatisch f\xFCllen +selectionToolAutoFill.shortdescription=Die Auswahl automatisch f\xFCllen +selectionTool.mode.text=Modus: +selectionTool.mode.shortdescription=<html>W\xE4hlt den Einf\xFCgemodus:<br>automatisch=abh\xE4ngig vom eingef\xFCgten Objekt<br>oben=als oberstes Objekt einf\xFCgen<br>\xFCber Boden=direkt \xFCber Boden einf\xFCgen<br>unter Boden=direkt unter Boden einf\xFCgen<br>unten=als unterstes Objekt einf\xFCgen +selectionTool.mode.auto=automatisch +selectionTool.mode.topmost=oben +selectionTool.mode.aboveFloor=\xFCber Boden +selectionTool.mode.belowFloor=unter Boden +selectionTool.mode.bottommost=unten + deletionTool.delete.text=L\xF6schen: deletionTool.delete.shortdescription=<html>W\xE4hlt die zu l\xF6schenden Objekte:<br>oberstes Objekt=nur das oberste Objekt im Bereich<br>alle=alle Objekte im Bereich<br>unterstes Objekt=nur das unterste Objekt im Bereich deletionTool.delete.top=oberstes Objekt Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_fr.properties 2008-07-23 19:20:42 UTC (rev 4402) @@ -26,6 +26,16 @@ #right= #mouse= +#selectionToolAutoFill.text= +#selectionToolAutoFill.shortdescription= +#selectionTool.mode.text= +#selectionTool.mode.shortdescription= +#selectionTool.mode.auto= +#selectionTool.mode.topmost= +#selectionTool.mode.aboveFloor= +#selectionTool.mode.belowFloor= +#selectionTool.mode.bottommost= + #deletionTool.delete.text= #deletionTool.delete.shortdescription= #deletionTool.delete.top= Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-23 19:01:38 UTC (rev 4401) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/action_sv.properties 2008-07-23 19:20:42 UTC (rev 4402) @@ -26,6 +26,16 @@ #right= #mouse= +#selectionToolAutoFill.text= +#selectionToolAutoFill.shortdescription= +#selectionTool.mode.text= +#selectionTool.mode.shortdescription= +#selectionTool.mode.auto= +#selectionTool.mode.topmost= +#selectionTool.mode.aboveFloor= +#selectionTool.mode.belowFloor= +#selectionTool.mode.bottommost= + #deletionTool.delete.text= #deletionTool.delete.shortdescription= #deletionTool.delete.top= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 19:56:57
|
Revision: 4403 http://gridarta.svn.sourceforge.net/gridarta/?rev=4403&view=rev Author: akirschbaum Date: 2008-07-23 19:57:03 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Fix crash when editing a non-existant script file. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -61,8 +61,6 @@ loadArchesNoArchfiles.title=No archfiles loadArchesNoArchfiles.message=No archfiles could be found. If you have no archfiles\nyet, you need to download them. If you do, make sure\nthe path is correct under menu ''File->Options''. -openScriptNotFound.title=Script file not found -openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -58,8 +58,6 @@ loadArchesNoArchfiles.title=Keine Archetypen gefunden loadArchesNoArchfiles.message=Es konnten keine Archetypen gefunden werden.\nBitte stellen Sie sicher, dass der Pfad\nunter ''Datei->Optionen...'' korrekt ist. -openScriptNotFound.title=Script-Datei nicht gefunden -openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -59,8 +59,6 @@ #loadArchesNoArchfiles.title= #loadArchesNoArchfiles.message= -#openScriptNotFound.title= -#openScriptNotFound.message= #loadDuplicateFace.title= #loadDuplicateFace.message= Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -57,8 +57,6 @@ loadArchesNoArchfiles.title=Inga arketypfiler loadArchesNoArchfiles.message=Inga arketypfiler kunde hittas. Om du saknar arketypfiler\n m\xE5ste du ladda hem dom. Om du g\xF6r detta, se till\natt s\xF6kv\xE4gen under ''Arkiv->Inst\xE4llningar'' \xE4r korrekt. -openScriptNotFound.title=Kunde inte hitta scriptfil -openScriptNotFound.message=Filen ''{0}'' finns inte.\nV\xE4r v\xE4nlig korrigera s\xF6kv\xE4gen. loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/daimonin/src/daieditor/messages.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -58,8 +58,6 @@ importSpellsFailed.message=Collecting spells failed!\nMaybe the specified file is of wrong format. loadArchesNoArchfiles.title=No archfiles loadArchesNoArchfiles.message=No archfiles could be found. If you have no archfiles\nyet, you need to download them. If you do, make sure\nthe path is correct under menu ''File->Options''. -openScriptNotFound.title=Script file not found -openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -58,8 +58,6 @@ importSpellsFailed.message=Das Sammeln der Zauberspr\xFCche ist fehlgeschlagen.\nEvtl. ist das Dateiformat falsch? loadArchesNoArchfiles.title=Keine Archetypen gefunden loadArchesNoArchfiles.message=Es konnten keine Archetypen gefunden werden.\nBitte stellen Sie sicher, dass der Pfad\nunter ''Datei->Optionen...'' korrekt ist. -openScriptNotFound.title=Script-Datei nicht gefunden -openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -58,8 +58,6 @@ #importSpellsFailed.message= #loadArchesNoArchfiles.title= #loadArchesNoArchfiles.message= -#openScriptNotFound.title= -#openScriptNotFound.message= #loadDuplicateFace.title= #loadDuplicateFace.message= Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -58,8 +58,6 @@ importSpellsFailed.message=Sammanst\xE4llning av trollformler misslyckades.\nVar den angivna filen inte av r\xE4tt format? loadArchesNoArchfiles.title=Inga arketypfiler loadArchesNoArchfiles.message=Inga arketypfiler kunde hittas. Om du saknar arketypfiler\n m\xE5ste du ladda hem dom. Om du g\xF6r detta, se till\natt s\xF6kv\xE4gen under ''Arkiv->Inst\xE4llningar'' \xE4r korrekt. -openScriptNotFound.title=Kunde inte hitta scriptfil -openScriptNotFound.message=Filen ''{0}'' finns inte.\nV\xE4r v\xE4nlig korrigera s\xF6kv\xE4gen. loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -188,6 +188,9 @@ dialogDontShowAgain=Show this dialog again next time. +openScriptNotFound.title=Script file not found +openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. + # New Map newMap.title=Create New Map newPickmap.title=Create New Pickmap Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -173,6 +173,9 @@ dialogDontShowAgain=Diesen Dialog n\xE4chstes Mal wieder anzeigen. +openScriptNotFound.title=Script-Datei nicht gefunden +openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. + # New Map newMap.title=Neue Karte erstellen newPickmap.title=Neue Pickmap erstellen Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -172,6 +172,9 @@ #dialogDontShowAgain= +#openScriptNotFound.title= +#openScriptNotFound.message= + # New Map #newMap.title= #newPickmap.title= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-07-23 19:20:42 UTC (rev 4402) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-07-23 19:57:03 UTC (rev 4403) @@ -175,6 +175,9 @@ dialogDontShowAgain=Visa inte denna dialog igen. +openScriptNotFound.title=Kunde inte hitta scriptfil +openScriptNotFound.message=Filen ''{0}'' finns inte.\nV\xE4r v\xE4nlig korrigera s\xF6kv\xE4gen. + # New Map newMap.title=Skapa ny karta newPickmap.title=Skapa ny plockkarta This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 20:31:22
|
Revision: 4405 http://gridarta.svn.sourceforge.net/gridarta/?rev=4405&view=rev Author: akirschbaum Date: 2008-07-23 20:31:30 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Fix #1852030 (Connection warning). Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/Archetype.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionChecker.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-23 19:57:24 UTC (rev 4404) +++ trunk/crossfire/ChangeLog 2008-07-23 20:31:30 UTC (rev 4405) @@ -1,5 +1,7 @@ -2008-07-23 Andreas Kirschbaum <xxx> +2008-07-23 Andreas Kirschbaum + * Fix #1852030 (Connection warning). + * Implement #1712767 (New insertion tool: Box Insert). 2008-07-22 Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 19:57:24 UTC (rev 4404) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 20:31:30 UTC (rev 4405) @@ -421,7 +421,7 @@ Archetype.TYPE_TRIGGER, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_TRIGGER_BUTTON, - }, new int[] { + }, new int[] { Archetype.TYPE_CREATOR, Archetype.TYPE_DIRECTOR, Archetype.TYPE_DUPLICATOR, @@ -433,7 +433,12 @@ Archetype.TYPE_TELEPORTER, Archetype.TYPE_TIMED_GATE, Archetype.TYPE_TRIGGER_MARKER, - }), + }, + Archetype.TYPE_EVENT_CONNECTOR, + "subtype", + new int[] { + Archetype.SUBTYPE_EVENT_CONNECTOR_TRIGGER, + }), customTypeChecker, new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), Modified: trunk/crossfire/src/cfeditor/gameobject/Archetype.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/Archetype.java 2008-07-23 19:57:24 UTC (rev 4404) +++ trunk/crossfire/src/cfeditor/gameobject/Archetype.java 2008-07-23 20:31:30 UTC (rev 4405) @@ -113,4 +113,6 @@ int TYPE_TRAP = 155; + int SUBTYPE_EVENT_CONNECTOR_TRIGGER = 10; + } // class Archetype Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 19:57:24 UTC (rev 4404) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-23 20:31:30 UTC (rev 4405) @@ -481,7 +481,7 @@ Archetype.TYPE_TIMER, Archetype.TYPE_TRIGGER_BUTTON, Archetype.TYPE_TRIGGER_PEDESTAL, - }, new int[] { + }, new int[] { Archetype.TYPE_APPLYABLE_LIGHT, Archetype.TYPE_CREATOR, Archetype.TYPE_DIRECTOR, @@ -496,7 +496,11 @@ Archetype.TYPE_TELEPORTER, Archetype.TYPE_TIMED_GATE, Archetype.TYPE_TIMER, - }), + }, + Archetype.TYPE_EVENT_OBJECT, + "sub_type", + new int[] { + }), customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(), Modified: trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionChecker.java 2008-07-23 19:57:24 UTC (rev 4404) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionChecker.java 2008-07-23 20:31:30 UTC (rev 4405) @@ -47,18 +47,36 @@ /** The type numbers of connected objects that are sinks. */ private final Set<Integer> sinks = new HashSet<Integer>(); + /** The type number for event objects. */ + private final int eventType; + + /** The attribute key for subtype numbers. */ + private final String eventSubtypeKey; + + /** The subtype numbers for sinks. */ + private final Set<Integer> eventSubtypes = new HashSet<Integer>(); + /** * Create a new instance. * @param sources The type numbers of connected objects that are sources. * @param sinks The type numbers of connected objects that are sinks. + * @param eventType The type number of event objects. + * @param eventSubtypeKey The subtype attribute key of event objects. + * @param eventSubtypes The subtype numbers of events objects that are + * sinks. */ - public ConnectionChecker(@NotNull final int[] sources, @NotNull final int[] sinks) { + public ConnectionChecker(@NotNull final int[] sources, @NotNull final int[] sinks, final int eventType, @NotNull final String eventSubtypeKey, @NotNull final int[] eventSubtypes) { for (final int source : sources) { this.sources.add(source); } for (final int sink : sinks) { this.sinks.add(sink); } + this.eventType = eventType; + this.eventSubtypeKey = eventSubtypeKey; + for (final int eventSubtype : eventSubtypes) { + this.eventSubtypes.add(eventSubtype); + } } /** {@inheritDoc} */ @@ -127,7 +145,25 @@ * @return whether the game object is a sink */ private boolean isSink(@NotNull final G gameObject) { - return sinks.contains(gameObject.getArchTypNr()); + if (sinks.contains(gameObject.getArchTypNr())) { + return true; + } + + for (final G inv : gameObject) { + if (inv.getArchTypNr() == eventType) { + final String subtypeSpec = inv.getAttributeString(eventSubtypeKey, true); + try { + final int subtype = Integer.parseInt(subtypeSpec); + if (eventSubtypes.contains(subtype)) { + return true; + } + } catch (final NumberFormatException ex) { + // ignore + } + } + } + + return false; } /** Manages information about one connection set. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 20:48:53
|
Revision: 4406 http://gridarta.svn.sourceforge.net/gridarta/?rev=4406&view=rev Author: akirschbaum Date: 2008-07-23 20:48:58 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Fix map validator error messages: include actual parameter rather than "null". Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/map/validation/ValidationError.java trunk/src/app/net/sf/gridarta/map/validation/checks/AttributeRangeError.java trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionError.java trunk/src/app/net/sf/gridarta/map/validation/checks/CustomTypeError.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/crossfire/ChangeLog 2008-07-23 20:48:58 UTC (rev 4406) @@ -1,5 +1,8 @@ 2008-07-23 Andreas Kirschbaum + * Fix map validator error messages: include actual parameter + rather than "null". + * Fix #1852030 (Connection warning). * Implement #1712767 (New insertion tool: Box Insert). Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/daimonin/ChangeLog 2008-07-23 20:48:58 UTC (rev 4406) @@ -1,5 +1,8 @@ -2008-07-23 Andreas Kirschbaum <xxx> +2008-07-23 Andreas Kirschbaum + * Fix map validator error messages: include actual parameter + rather than "null". + * Implement #1712767 (New insertion tool: Box Insert). 2008-07-22 Andreas Kirschbaum Modified: trunk/src/app/net/sf/gridarta/map/validation/ValidationError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/ValidationError.java 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/src/app/net/sf/gridarta/map/validation/ValidationError.java 2008-07-23 20:48:58 UTC (rev 4406) @@ -92,16 +92,6 @@ /** * A parameter string to be used in the error message. It can be accessed - * with {4}. - * @return The error string. - */ - @Nullable - public String getParameter() { - return getParameter(0); - } - - /** - * A parameter string to be used in the error message. It can be accessed * with {4+<code>id</code>}. * @param id The error id. * @return The error string. Modified: trunk/src/app/net/sf/gridarta/map/validation/checks/AttributeRangeError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/AttributeRangeError.java 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/AttributeRangeError.java 2008-07-23 20:48:58 UTC (rev 4406) @@ -47,8 +47,12 @@ /** {@inheritDoc} */ @Nullable @Override - public String getParameter() { - return attributeName; + public String getParameter(final int id) { + if (id == 0) { + return attributeName; + } else { + return super.getParameter(id); + } } } // class AttributeRangeError Modified: trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionError.java 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionError.java 2008-07-23 20:48:58 UTC (rev 4406) @@ -47,8 +47,13 @@ /** {@inheritDoc} */ @Nullable - public String getParameter() { - return Integer.toString(connected); + @Override + public String getParameter(final int id) { + if (id == 0) { + return Integer.toString(connected); + } else { + return super.getParameter(id); + } } } // class ConnectionError Modified: trunk/src/app/net/sf/gridarta/map/validation/checks/CustomTypeError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/CustomTypeError.java 2008-07-23 20:31:30 UTC (rev 4405) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/CustomTypeError.java 2008-07-23 20:48:58 UTC (rev 4406) @@ -51,6 +51,7 @@ /** {@inheritDoc} */ @Nullable + @Override public String getParameter(final int id) { if (id == 0) { return Integer.toString(archetypeType); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 20:59:35
|
Revision: 4407 http://gridarta.svn.sourceforge.net/gridarta/?rev=4407&view=rev Author: akirschbaum Date: 2008-07-23 20:59:43 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Fix spurious map validator warning for detectors. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/src/app/net/sf/gridarta/map/validation/checks/UnsetSlayingChecker.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-07-23 20:48:58 UTC (rev 4406) +++ trunk/crossfire/ChangeLog 2008-07-23 20:59:43 UTC (rev 4407) @@ -1,5 +1,7 @@ 2008-07-23 Andreas Kirschbaum + * Fix spurious map validator warning for detectors. + * Fix map validator error messages: include actual parameter rather than "null". Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 20:48:58 UTC (rev 4406) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 20:59:43 UTC (rev 4407) @@ -404,6 +404,8 @@ final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(); customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_WALL); customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_FLOOR); + final UnsetSlayingChecker<GameObject, MapArchObject, Archetype> unsetSlayingChecker = new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); + unsetSlayingChecker.addAllowedValue("player"); mapValidators.add( attributeRangeChecker, new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(), @@ -442,7 +444,7 @@ customTypeChecker, new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), - new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER) + unsetSlayingChecker ); return mapValidators; } Modified: trunk/src/app/net/sf/gridarta/map/validation/checks/UnsetSlayingChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/UnsetSlayingChecker.java 2008-07-23 20:48:58 UTC (rev 4406) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/UnsetSlayingChecker.java 2008-07-23 20:59:43 UTC (rev 4407) @@ -37,21 +37,33 @@ /** The object types to check. */ private final Set<Integer> types = new HashSet<Integer>(); + /** The values which do not trigger a warning. */ + private final Set<String> allowedValues = new HashSet<String>(); + /** * Create a new instance. * @param types The object types to check. */ public UnsetSlayingChecker(final Integer... types) { + allowedValues.add(""); for (final Integer type : types) { this.types.add(type); } } + /** + * Adds a value which does not trigger a warning. + * @param value + */ + public void addAllowedValue(final String value) { + allowedValues.add(value); + } + /** {@inheritDoc} */ public void validate(final G gameObject, final ErrorCollector<G, A, R> errorCollector) { if (types.contains(gameObject.getArchTypNr())) { final String slayingArchetype = gameObject.getArchetype().getAttributeString("slaying"); - if (slayingArchetype.length() > 0) { + if (!allowedValues.contains(slayingArchetype)) { final String slayingObject = gameObject.getAttributeString("slaying"); if (slayingArchetype.equals(slayingObject)) { errorCollector.collect(new UnsetSlayingError<G, A, R>(gameObject)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 21:52:26
|
Revision: 4408 http://gridarta.svn.sourceforge.net/gridarta/?rev=4408&view=rev Author: akirschbaum Date: 2008-07-23 21:52:33 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Rewrite ScriptArchUtils to make it more flexible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 20:59:43 UTC (rev 4407) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-23 21:52:33 UTC (rev 4408) @@ -39,9 +39,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; import java.util.Collections; -import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.prefs.Preferences; @@ -300,7 +298,7 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } mapActions = new MapActions(this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - typeList.getListTable().put("event", getEventTypes()); + typeList.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); typeList.loadTypesFromXML(filename); @@ -853,15 +851,6 @@ return getConfigurationDirectory(); } - private static List<?> getEventTypes() { - final List<Object> result = new ArrayList<Object>(); - for (int typeNumber = 1; ScriptArchUtils.getArchetypeNameForEventType(typeNumber) != null; typeNumber++) { - result.add(typeNumber); - result.add(ScriptArchUtils.typeName(typeNumber)); - } - return result; - } - /** {@inheritDoc} */ public boolean isAutoJoin() { return mapActions.isAutoJoin(); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-07-23 20:59:43 UTC (rev 4407) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-07-23 21:52:33 UTC (rev 4408) @@ -42,7 +42,7 @@ public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); - final int eventType = eventTypeBox.getSelectedIndex() + 1; + final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 20:59:43 UTC (rev 4407) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:52:33 UTC (rev 4408) @@ -19,40 +19,69 @@ package cfeditor.gameobject.scripts; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.swing.JComboBox; import net.sf.japi.util.Arrays2; import org.jetbrains.annotations.Nullable; public class ScriptArchUtils { + /** + * Maps event type to event name. + */ + private static final Map<Integer, String> allEventTypes = new HashMap<Integer, String>(); + + /** + * Maps index into {@link #eventNames} to event type. + */ + private static final Map<Integer, Integer> indexToEventType = new HashMap<Integer, Integer>(); + + /** + * All event names. + */ + private static final List<String> eventNames = new ArrayList<String>(); + // FIXME: This should NOT BE HERE. Instead, it should be read from types.xml. - private static final String[] allEventTypes = new String[] { - "apply", - "attack", - "death", - "drop", - "pickup", - "say", - "stop", - "time", - "throw", - "trigger", - "close", - "timer", - "destroy", + static { + add(1, "apply"); + add(2, "attack"); + add(3, "death"); + add(4, "drop"); + add(5, "pickup"); + add(6, "say"); + add(7, "stop"); + add(8, "time"); + add(9, "throw"); + add(10, "trigger"); + add(11, "close"); + add(12, "timer"); + add(13, "destroy"); }; /** + * Adds on event description. + * @param eventType the event type + * @param eventName the event name + */ + public static void add(final int eventType, final String eventName) { + assert !allEventTypes.containsKey(eventType); + allEventTypes.put(eventType, eventName); + indexToEventType.put(eventNames.size(), eventType); + eventNames.add(eventName); + } + + /** * Return a human readable name for an event type. * @param eventType the event type * @return the event type name */ public static String typeName(final int eventType) { - if (eventType > 0 && eventType <= allEventTypes.length) { - return allEventTypes[eventType - 1]; - } else { - return "<invalid type>"; - } + final String typeName = allEventTypes.get(eventType); + return typeName != null ? typeName : "<invalid type>"; } /** @@ -63,17 +92,42 @@ */ @Nullable public static String getArchetypeNameForEventType(final int eventType) { - if (eventType > 0 && eventType <= allEventTypes.length) { - return "event_" + allEventTypes[eventType - 1]; - } else { - return null; - } + final String typeName = allEventTypes.get(eventType); + return typeName != null ? "event_" + typeName : null; } public static JComboBox createEventTypeBox() { - final JComboBox eventTypeBox = new JComboBox(allEventTypes); - eventTypeBox.setSelectedIndex(Arrays2.linearEqualitySearch("say", allEventTypes)); + final Collection<String> values = allEventTypes.values(); + final String[] valuesArray = values.toArray(new String[values.size()]); + final JComboBox eventTypeBox = new JComboBox(valuesArray); + eventTypeBox.setSelectedIndex(Arrays2.linearEqualitySearch("say", valuesArray)); return eventTypeBox; } + /** + * Converts a combo box index to an event type. + * @param index the combo box index + * @return the event type + */ + public static int indexToEventType(final int index) { + try { + return indexToEventType.get(index); + } catch (final NullPointerException ex) { + return 0; + } + } + + /** + * Returns all event types. + * @return the event types + */ + public static List<?> getEventTypes() { + final List<Object> result = new ArrayList<Object>(); + for (final Map.Entry<Integer, String> e : allEventTypes.entrySet()) { + result.add(e.getKey()); + result.add(e.getValue()); + } + return result; + } + } // class ScriptArchUtils Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-07-23 20:59:43 UTC (rev 4407) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-07-23 21:52:33 UTC (rev 4408) @@ -42,7 +42,7 @@ public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); - final int eventType = eventTypeBox.getSelectedIndex() + 1; + final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 20:59:43 UTC (rev 4407) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:52:33 UTC (rev 4408) @@ -72,4 +72,13 @@ return eventTypeBox; } + /** + * Converts a combo box index to an event type. + * @param index the combo box index + * @return the event type + */ + public static int indexToEventType(final int index) { + return index + 1; + } + } // class ScriptArchUtils This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-23 21:53:54
|
Revision: 4409 http://gridarta.svn.sourceforge.net/gridarta/?rev=4409&view=rev Author: akirschbaum Date: 2008-07-23 21:54:02 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Add private constructor to utility class. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:52:33 UTC (rev 4408) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:54:02 UTC (rev 4409) @@ -63,6 +63,12 @@ }; /** + * Private constructor to prevent instantiation. + */ + private ScriptArchUtils() { + } + + /** * Adds on event description. * @param eventType the event type * @param eventName the event name Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:52:33 UTC (rev 4408) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchUtils.java 2008-07-23 21:54:02 UTC (rev 4409) @@ -43,6 +43,12 @@ }; /** + * Private constructor to prevent instantiation. + */ + private ScriptArchUtils() { + } + + /** * Return a human readable name for an event type. * @param eventType the event type * @return the event type name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 09:40:49
|
Revision: 4420 http://gridarta.svn.sourceforge.net/gridarta/?rev=4420&view=rev Author: akirschbaum Date: 2008-07-25 09:40:55 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove call to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 07:49:37 UTC (rev 4419) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 09:40:55 UTC (rev 4420) @@ -233,7 +233,7 @@ archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); scriptControl = new ScriptController(this); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, null); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 07:49:37 UTC (rev 4419) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 09:40:55 UTC (rev 4420) @@ -286,7 +286,7 @@ animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH)); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-25 07:49:37 UTC (rev 4419) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-25 09:40:55 UTC (rev 4420) @@ -28,6 +28,7 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -85,11 +86,12 @@ * or on the top of the main view * @param compassIcon If non-<code>null</code>, display this icon on the top * of the list + * @param archetypeSet the archetype set to use */ - public SelectedSquareControl(@NotNull final ActionFactory actionFactory, final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon) { + public SelectedSquareControl(@NotNull final ActionFactory actionFactory, final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { this.mainControl = mainControl; - view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mainControl, mapTileListBottom, compassIcon); + view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mainControl, mapTileListBottom, compassIcon, archetypeSet); } MouseListener getMouseListener() { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-25 07:49:37 UTC (rev 4419) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-25 09:40:55 UTC (rev 4420) @@ -41,6 +41,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; @@ -217,8 +218,9 @@ * or on the top of the main view * @param compassIcon if non-<code>null</code>, display this icon on the top * of the list + * @param archetypeSet the archetype set to use */ - SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @NotNull final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon) { + SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @NotNull final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { this.mainControl = mainControl; this.control = control; mapTileSelectionCache = new MapTileSelectionCache<G, A, R, V>(mainControl.getMapManager()); @@ -227,7 +229,7 @@ model = new DefaultListModel(); list = new JList(model); - list.setCellRenderer(new CellRenderer<G, A, R>(mainControl.getArchetypeSet())); + list.setCellRenderer(new CellRenderer<G, A, R>(archetypeSet)); list.setBackground(Color.lightGray); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final JScrollPane scrollPane = new JScrollPane(list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 17:55:25
|
Revision: 4428 http://gridarta.svn.sourceforge.net/gridarta/?rev=4428&view=rev Author: akirschbaum Date: 2008-07-25 17:55:30 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Improve map model transaction system to distinguish between 'square changes' and 'game object changes'. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapModelListener.java trunk/src/app/net/sf/gridarta/map/MapSquare.java Added Paths: ----------- trunk/src/test/net/sf/gridarta/map/ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -116,9 +116,9 @@ /** {@inheritDoc} */ public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - final GameObject[] gameObjects = e.getGameObjects(); + final net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype>[] gameObjects = e.getGameObjects(); if (gameObjects != null) { - for (final GameObject gameObject : gameObjects) { + for (final net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype> gameObject : gameObjects) { if (!gameObject.isInContainer()) { final MapSquare<GameObject, MapArchObject, Archetype> square = gameObject.getMapSquare(); if (square != null) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -537,6 +537,15 @@ return container != null ? container.getMapSquare() : null; } + /** {@inheritDoc} */ + @Override + protected void notifyChanged() { + final MapSquare<G, A, R> mapSquare = getMapSquare(); + if (mapSquare != null) { + mapSquare.getMapModel().gameObjectChanged((G) this); + } + } + /** Move this GameObject top. Does nothing if the object has no container. */ public void moveTop() { if (isArchetype()) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -423,15 +423,9 @@ public abstract MapSquare<G, A, R> getMapSquare(); /** - * Tell the model that this MapSquare has changed. This method must be - * invoked by all other methods that change something. + * Notify the map model that this container has changed. */ - protected final void notifyChanged() { - final MapSquare<G, A, R> square = getMapSquare(); - if (square != null) { - square.getMapModel().squareChanged(square); - } - } + protected abstract void notifyChanged(); /** * {@inheritDoc} Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -244,7 +244,11 @@ /** {@inheritDoc} */ public void mapObjectsChanged(final MapModelEvent<G, A, R> e) { - // ignore + for (final G gameObject : e.getGameObjects()) { + if (selectedGameObject == gameObject) { + refreshDisplay(); + } + } } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -317,6 +317,16 @@ } } + // discard changed game objects that are now out of map bounds + final Iterator<G> it2 = changedGameObjects.iterator(); + while (it2.hasNext()) { + final G gameObject = it2.next(); + final G topGameObject = gameObject.getTopContainer(); + if (topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { + it2.remove(); + } + } + fireMapSizeChanged(); } } @@ -362,9 +372,6 @@ } else { synchronized (changedGameObjects) { changedGameObjects.add(gameObject); - synchronized (changedSquares) { - changedSquares.add(gameObject.getMapSquare()); - } } } } @@ -401,15 +408,24 @@ if (transactionDepth == 0) { commitTransaction(); } else if (fireEvent && transactionDepth == 1) { - if (!changedGameObjects.isEmpty()) { - fireGameObjectsChangedEvent(changedGameObjects.toArray((G[]) new GameObject[changedGameObjects.size()])); - } - if (!changedSquares.isEmpty()) { - fireMapSquaresChangedEvent(changedSquares.toArray(new MapSquare[changedSquares.size()])); - } + fireEvents(); } } + /** + * Deliver all pending events. + */ + private void fireEvents() { + if (!changedGameObjects.isEmpty()) { + fireGameObjectsChangedEvent(changedGameObjects.toArray((G[]) new GameObject[changedGameObjects.size()])); + changedGameObjects.clear(); + } + if (!changedSquares.isEmpty()) { + fireMapSquaresChangedEvent(changedSquares.toArray(new MapSquare[changedSquares.size()])); + changedSquares.clear(); + } + } + /** {@inheritDoc} */ public void endAllTransactions() { if (transactionDepth > 0) { @@ -424,10 +440,7 @@ private void commitTransaction() { transactionDepth = 0; transactionThread = null; - if (!changedSquares.isEmpty()) { - fireMapSquaresChangedEvent(changedSquares.toArray(new MapSquare[changedSquares.size()])); - changedSquares.clear(); - } + fireEvents(); fireEndTransaction(); } Modified: trunk/src/app/net/sf/gridarta/map/MapModelListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapModelListener.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/map/MapModelListener.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -42,9 +42,6 @@ * <li>A GameObject was removed from a MapSquare</li> * <li>A GameObject was moved up or down within a MapSquare</li> * </ul> - * Currently, this event also is fired in case of inventory items. In - * future, this event will only be fired for changes to the top level - * contents of a MapSquare. * @param e EventObject with event information */ void mapSquaresChanged(MapModelEvent<G, A, R> e); @@ -57,7 +54,6 @@ * <li>The inventory of a GameObject has changed (items added, removed or * moved)</li> * </ul> - * Currently, this event type is unused. * @param e EventObject with event information */ void mapObjectsChanged(MapModelEvent<G, A, R> e); Modified: trunk/src/app/net/sf/gridarta/map/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-25 17:35:39 UTC (rev 4427) +++ trunk/src/app/net/sf/gridarta/map/MapSquare.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -62,7 +62,6 @@ this.mapModel = mapModel; this.mapX = mapX; this.mapY = mapY; - notifyChanged(); } /** @@ -94,6 +93,12 @@ } /** {@inheritDoc} */ + @Override + protected void notifyChanged() { + mapModel.squareChanged(this); + } + + /** {@inheritDoc} */ @NotNull @Override protected MapSquare<G, A, R> clone() throws CloneNotSupportedException { Added: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-25 17:55:30 UTC (rev 4428) @@ -0,0 +1,977 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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 test.net.sf.gridarta.map; + +import java.awt.Point; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; +import javax.swing.ImageIcon; +import javax.swing.JList; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.CFArchTypeList; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.Size2D; +import net.sf.gridarta.gameobject.AbstractArchetypeParser; +import net.sf.gridarta.gameobject.AbstractArchetypeSet; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.GameObjectAttributesPanel; +import net.sf.gridarta.gui.MainActions; +import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.io.GameObjectParser; +import net.sf.gridarta.io.MapArchObjectParser; +import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.DefaultMapModel; +import net.sf.gridarta.map.InsertionMode; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapArchObjectListener; +import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapModel; +import net.sf.gridarta.map.MapModelEvent; +import net.sf.gridarta.map.MapModelListener; +import net.sf.gridarta.map.MapSquare; +import net.sf.gridarta.spells.GameObjectSpell; +import net.sf.gridarta.spells.NumberSpell; +import net.sf.gridarta.spells.Spells; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test for {@link DefaultMapModel}. + * @author Andreas Kirschbaum + */ +@SuppressWarnings({"FeatureEnvy"}) +// This is a test. It has feature envy by definition. +public class DefaultMapModelTest { + + /** + * The map model listener registered to {@link #mapModel} to record map + * changes. + */ + private final MapModelListener<TestGameObject, TestMapArchObject, TestArchetype> mapModelListener = new MapModelListener<TestGameObject, TestMapArchObject, TestArchetype>() { + + /** {@inheritDoc} */ + public void mapSizeChanged(final MapModelEvent<TestGameObject, TestMapArchObject, TestArchetype> e) { + log("mapSizeChanged", e); + } + + /** {@inheritDoc} */ + public void mapSquaresChanged(final MapModelEvent<TestGameObject, TestMapArchObject, TestArchetype> e) { + log("mapSquaresChanged", e); + } + + /** {@inheritDoc} */ + public void mapObjectsChanged(final MapModelEvent<TestGameObject, TestMapArchObject, TestArchetype> e) { + log("mapObjectsChanged", e); + } + + /** {@inheritDoc} */ + public void errorsChanged(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel) { + result.append("errorsChanged"); + } + + /** {@inheritDoc} */ + public void mapMetaChanged(@NotNull final TestMapArchObject mapArchObject) { + result.append("mapMetaChanged"); + } + + }; + + /** + * Collects the map model changes. + */ + private final StringBuilder result = new StringBuilder(); + + /** + * The gridarta objects factory to use. + */ + private GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory = null; + + /** + * The map model that gets changed. + */ + private DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = null; + + /** Test case for an empty transaction. */ + @Test + public void testEmpty() { + mapModel.beginTransaction("TEST"); + mapModel.endTransaction(); + Assert.assertEquals("", result.toString()); + } + + /** Test case for {@link DefaultMapModel#resizeMap(Size2D)}. */ + @Test + public void testResizeMap1() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + mapModel.endTransaction(); + Assert.assertEquals( + "mapSizeChanged:\n" + + "type SIZE_CHANGED\n" + + "no squares\n" + + "no game objects\n", + result.toString()); + } + + /** Test case for {@link DefaultMapModel#resizeMap(Size2D)}. */ + @Test + public void testResizeMap2() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + mapModel.endTransaction(); + Assert.assertEquals("", result.toString()); + } + + /** Test case for {@link DefaultMapModel#resizeMap(Size2D)}. */ + @Test + public void testResizeMap3() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + addGameObjectToMap(mapModel, "1", 2, 2, InsertionMode.AUTO); + mapModel.resizeMap(new Size2D(1, 2)); // cancels square changed event + mapModel.endTransaction(); + Assert.assertEquals( + "mapSizeChanged:\n" + + "type SIZE_CHANGED\n" + + "no squares\n" + + "no game objects\n", + result.toString()); + } + + /** Test case for {@link DefaultMapModel#resizeMap(Size2D)}. */ + @Test + public void testResizeMap4() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + for (final TestGameObject gameObject : mapModel.getMapSquare(new Point(1, 2))) { + gameObject.setAttributeString("key", "value"); + } + addGameObjectToMap(mapModel, "1", 2, 2, InsertionMode.AUTO); + mapModel.resizeMap(new Size2D(1, 2)); // cancels square changed event + mapModel.endTransaction(); + Assert.assertEquals( + "mapSizeChanged:\n" + + "type SIZE_CHANGED\n" + + "no squares\n" + + "no game objects\n", + result.toString()); + } + + /** Test case for {@link DefaultMapModel#addGameObjectToMap(GameObject, InsertionMode)}. */ + @Test + public void testAddGameObjectToMap1() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + Assert.assertEquals( + "mapSquaresChanged:\n" + + "type SQUARES_CHANGED\n" + + "square 1 2\n" + + "no game objects\n", + result.toString()); + } + + /** Test case for {@link DefaultMapModel#addGameObjectToMap(GameObject, InsertionMode)}. */ + @Test + public void testAddGameObjectToMap2() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + addGameObjectToMap(mapModel, "1", 2, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + Assert.assertEquals( + "mapSquaresChanged:\n" + + "type SQUARES_CHANGED\n" + + "square 1 2\n" + + "square 2 2\n" + + "no game objects\n", + result.toString()); + } + + /** Test case for changed objects. */ + @Test + public void testModifiedGameObject1() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + for (final TestGameObject gameObject : mapModel.getMapSquare(new Point(1, 2))) { + insertGameObject(gameObject, "2"); + } + mapModel.endTransaction(); + Assert.assertEquals( + "mapObjectsChanged:\n" + + "type GAMEOBJECTS_CHANGED\n" + + "no squares\n" + + "game object 1 2 1\n", + result.toString()); + } + + /** Test case for changed objects. */ + @Test + public void testModifiedGameObject2() { + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(4, 3)); + addGameObjectToMap(mapModel, "1", 1, 2, InsertionMode.AUTO); + mapModel.endTransaction(); + + result.setLength(0); + mapModel.beginTransaction("TEST"); + for (final TestGameObject gameObject : mapModel.getMapSquare(new Point(1, 2))) { + gameObject.setAttributeString("key", "value"); + } + mapModel.endTransaction(); + Assert.assertEquals( + "mapObjectsChanged:\n" + + "type GAMEOBJECTS_CHANGED\n" + + "no squares\n" + + "game object 1 2 1\n", + result.toString()); + } + + /** + * Inserts a game object into a map. + * @param mapModel the map to add to + * @param name the name of the game object to add + * @param x the x coordinate to add to + * @param y the y coordinate to add to + * @param insertionMode the insertion mode to use + */ + private void addGameObjectToMap(final DefaultMapModel mapModel, final String name, final int x, final int y, final InsertionMode insertionMode) { + final TestGameObject gameObject = newGameObject(name); + gameObject.setMapX(x); + gameObject.setMapY(y); + mapModel.addGameObjectToMap(gameObject, insertionMode); + } + + /** + * Inserts a game object into the inventory of another game object. + * @param gameObject the game object to add to + * @param name the name of the game object to add + */ + private void insertGameObject(final TestGameObject gameObject, final String name) { + final TestGameObject inv = newGameObject(name); + gameObject.addLast(inv); + } + + /** + * Creates a new game object. + * @param objectName the object name to set + * @return the game object + */ + private TestGameObject newGameObject(final String objectName) { + final TestGameObject gameObject = gridartaObjectsFactory.newGameObject(); + gameObject.getArchetype().setObjName(objectName); + return gameObject; + } + + /** + * Records a change event. + * @param name the event name + * @param e the event details + */ + private void log(final String name, final MapModelEvent<TestGameObject, TestMapArchObject, TestArchetype> e) { + result.append(name); + result.append(":\n"); + result.append("type "); + result.append(e.getType()); + result.append("\n"); + final MapSquare<TestGameObject, TestMapArchObject, TestArchetype>[] mapSquares = e.getSquares(); + if (mapSquares != null) { + final SortedSet<String> lines = new TreeSet<String>(); + for (final MapSquare<TestGameObject, TestMapArchObject, TestArchetype> mapSquare : mapSquares) { + lines.add("square " + mapSquare.getMapX() + " " + mapSquare.getMapY() + "\n"); + } + for (final String line : lines) { + result.append(line); + } + } else { + result.append("no squares\n"); + } + final GameObject<TestGameObject, TestMapArchObject, TestArchetype>[] gameObjects = e.getGameObjects(); + if (gameObjects != null) { + final SortedSet<String> lines = new TreeSet<String>(); + for (final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject : gameObjects) { + lines.add("game object " + gameObject.getMapX() + " " + gameObject.getMapY() + " " + gameObject.getBestName() + "\n"); + } + for (final String line : lines) { + result.append(line); + } + } else { + result.append("no game objects\n"); + } + } + + /** + * Sets up a test. + */ + @Before + public void setUp() { + final ActionFactory actionFactory = ActionFactory.getFactory("test"); + gridartaObjectsFactory = new TestGridartaObjectsFactory(); + final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test"); + final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); + final SelectedSquareControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareControl = new SelectedSquareControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(actionFactory, mainControl, true, null, archetypeSet); + final TestMapArchObject mapArchObject = new TestMapArchObject(); + final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, false); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, null, mapArchObject, false, null, archetypeChooserControl, selectedSquareControl.getSelectedSquareView()); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl); + + result.setLength(0); + mapModel.addMapModelListener(mapModelListener); + Assert.assertEquals("", result.toString()); + } + + /** + * A {@link MainControl} implementation for testing purposes. + */ + private static class TestMainControl extends AbstractMainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + + /** + * Creates a new instance. + * @param gridartaObjectsFactory the gridaarta objects factory to use + * @param key the action factory key to use + */ + protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key) { + super(gridartaObjectsFactory, key); + } + + /** {@inheritDoc} */ + public GlobalSettings getGlobalSettings() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public FileFilter getScriptFileFilter() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String getScriptSuffix() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> getArchetypeSet() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> getArchetypeParser() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public AnimationObjects<?> getAnimationObjects() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> getMainView() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public MapView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> getCurrentMapView() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean saveLevelAsWanted(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicMapControl) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void revert(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicMapControl) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void exit() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public String getConfigurationDirectory() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public String getCollectedDirectory() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public CFArchTypeList getTypeList() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public Spells<NumberSpell> getNumberSpells() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public Spells<GameObjectSpell<TestGameObject, TestMapArchObject, TestArchetype>> getGameObjectSpells() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void doExit() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void openAttrDialog(final TestGameObject gameObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void validateMap(final MapModel<TestGameObject, TestMapArchObject, TestArchetype> map) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void reloadFaces() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean isAutoJoin() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> getObjectChooser() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public MainActions<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> getMainActions() { + throw new AssertionError(); + } + } + + /** + * A {@link MapControl} implementation for testing purposes. + */ + private static class TestMapControl extends DefaultMapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + + /** + * Creates a new instance + * @param gridartaObjectsFactory the gridarta objects factory to use + * @param mainControl the main control + * @param objects the objects to insert + * @param mapArchObject the map arch object to use + * @param isPickmap whether this map control is a pickmap + * @param exitTypeGameObjectMatcher the exit matcher to use + * @param archetypeChooserControl the archetype chooser control to use + * @param selectedSquareView the selected square view to use + */ + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView) { + super(gridartaObjectsFactory, mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, selectedSquareView); + } + + } + + /** + * A {@link MapArchObject} implementation for testing purposes. + */ + private static class TestMapArchObject implements MapArchObject<TestMapArchObject> { + + /** + * The current map size. + */ + private Size2D mapSize = Size2D.ONE; + + /** {@inheritDoc} */ + public void setState(@NotNull final TestMapArchObject mapArchObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String getMapDisplayName() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setMapSize(@NotNull final Size2D mapSize) { + this.mapSize = mapSize; + } + + /** {@inheritDoc} */ + @NotNull + public Size2D getMapSize() { + return mapSize; + } + + /** {@inheritDoc} */ + @NotNull + public String getMapName() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setMapName(@NotNull final String name) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getEnterX() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setEnterX(final int enterX) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getEnterY() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setEnterY(final int enterY) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean isOutdoor() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setOutdoor(final boolean outdoor) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getResetTimeout() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setResetTimeout(final int resetTimeout) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getSwapTime() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setSwapTime(final int swapTime) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getDifficulty() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setDifficulty(final int difficulty) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean isFixedReset() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setFixedReset(final boolean fixedReset) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getDarkness() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setDarkness(final int darkness) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int getTilePaths() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public String getTilePath(final int direction) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setTilePath(final int direction, @NotNull final String tilePath) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public TestMapArchObject createClone() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void addMapArchObjectListener(@NotNull final MapArchObjectListener<TestMapArchObject> mapArchObjectListener) { + // ignore + } + + /** {@inheritDoc} */ + public void removeMapArchObjectListener(@NotNull final MapArchObjectListener<TestMapArchObject> mapArchObjectListener) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void resetModified() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void beginTransaction() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void endTransaction() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void endTransaction(final boolean fireEvent) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void addText(@NotNull final String text) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setText(final String text) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public String getText() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void updateModifiedAttribute() { + throw new AssertionError(); + } + + } + + /** + * A {@link MapViewBasic} implementation for testing purposes. + */ + private static class TestMapViewBasic extends MapViewBasic<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + + /** + * Creates a new instance. + * @param mapControl the map control + * @param initial the initial view position + * @param xScrollDistance the x scroll distance + * @param yScrollDistance the y scroll distance + * @param selectedSquareView the selected square view to use + */ + protected TestMapViewBasic(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControl, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView) { + super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); + } + + /** {@inheritDoc} */ + public void init(@NotNull final MapView mapView) { + throw new AssertionError(); + } + + } + + /** + * A {@link GameObject} implementation for testing purposes. + */ + private static class TestGameObject extends GameObject<TestGameObject, TestMapArchObject, TestArchetype> { + + /** The serial version UID. */ + private static final long serialVersionUID = 1; + + /** {@inheritDoc} */ + public TestGameObject createGameObject() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean isMulti() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setAnimName(@Nullable final String animName) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String getAnimName() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean usesDirection() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void setObjectFace() { + // ignore + } + + /** {@inheritDoc} */ + public void setRealFace(@Nullable final String name) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public TestGameObject createClone(final int posx, final int posy) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public TestGameObject createMultiClone(final int posx, final int posy) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void propagateElevation(final TestGameObject gameObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void addEventsToJList(@NotNull final JList list) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean isScripted() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void postParseGameObject(final int editType) { + throw new AssertionError(); + } + + } + + /** + * An {@link Archetype} implementation for testing purposes. + */ + private static class TestArchetype extends TestGameObject { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + } + + /** + * An {@link GridartaObjectsFactory} implementation for testing purposes. + */ + private static class TestGridartaObjectsFactory implements GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + + /** {@inheritDoc} */ + @NotNull + public TestMapArchObject newMapArchObject(final boolean addDefaultAttributes) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public TestGameObject newGameObject() { + final TestGameObject gameObject = new TestGameObject(); + gameObject.setArchetype(new TestArchetype()); + return gameObject; + } + + /** {@inheritDoc} */ + @NotNull + public MapReader<TestGameObject, TestMapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public TestArchetype newUndefinedArchetype(@NotNull final String archetypeName) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public MapArchObjectParser<TestMapArchObject> newMapArchObjectParser() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> newGameObjectParser() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeMapModel, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeArchetypeSet) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public MapView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicMapControl, @Nullable final Point viewPosition, final int viewCounter) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicSelectedSquareView) { + throw new AssertionError(); + } + } + + /** + * An {@link ArchetypeSet} implementation for testing purposes. + */ + private static class TestArchetypeSet extends AbstractArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> { + + /** + * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory to use + */ + private TestArchetypeSet(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, ?> gridartaObjectsFactory) { + super(gridartaObjectsFactory); + } + + /** {@inheritDoc} */ + public void loadArchetypes(@NotNull final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeAbstractArchetypeParser) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public ImageIcon getFace(@NotNull final TestArchetype archetype) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public ImageIcon getFace(@NotNull final TestGameObject gameObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + throw new AssertionError(); + } + + } + +} // class DefaultMapModelTest Property changes on: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:02:48
|
Revision: 4431 http://gridarta.svn.sourceforge.net/gridarta/?rev=4431&view=rev Author: akirschbaum Date: 2008-07-25 20:02:53 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Inline getters and setters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/script/ScriptModel.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CFArchType.java trunk/src/app/net/sf/gridarta/data/AbstractNamedObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObject.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java trunk/src/app/net/sf/gridarta/treasurelist/TreasureTreeNode.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -313,9 +313,9 @@ validateAllEvents(); // we don't handle anim yet, so attach then back to archtext - if (getAnimText() != null) { + if (animText != null) { addObjectText("anim"); - addObjectText(getAnimText()); + addObjectText(animText); addObjectText("mina"); } Modified: trunk/crossfire/src/cfeditor/script/ScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -422,12 +422,12 @@ final Element root = new Element("script"); final Element n = new Element("name"); final Element c = new Element("code"); - n.addContent(getName()); + n.addContent(name); try { - c.addContent(new CDATA(getCode()));// protect code in xml! + c.addContent(new CDATA(code));// protect code in xml! } catch (final IllegalDataException e) { //can't be converted to CDATA :( - c.addContent(getCode()); + c.addContent(code); } root.addContent(n); root.addContent(c); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -478,10 +478,10 @@ if (archetype.getMultiShapeID() > 0 && getMultiShapeID() == 0) { setMultiShapeID(archetype.getMultiShapeID()); } - if (archetype.getMultiPartNr() > 0 && getMultiPartNr() == 0) { - setMultiPartNr(archetype.getMultiPartNr()); + if (archetype.getMultiPartNr() > 0 && multiPartNr == 0) { + multiPartNr = archetype.getMultiPartNr(); } - setLowestPart(archetype.isLowestPart()); + isLowestPart = archetype.isLowestPart(); setMultiX(archetype.getMultiX()); setMultiY(archetype.getMultiY()); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -219,7 +219,7 @@ /** {@inheritDoc} */ public File getLocalMapDir() { - final MapControl<G, A, R, V> mapControl = getMapManager().getCurrentMap(); + final MapControl<G, A, R, V> mapControl = mapManager.getCurrentMap(); if (mapControl == null) { return getGlobalSettings().getMapDir(); } Modified: trunk/src/app/net/sf/gridarta/CFArchType.java =================================================================== --- trunk/src/app/net/sf/gridarta/CFArchType.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/CFArchType.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -456,39 +456,39 @@ } public boolean matches(@NotNull final Archetype<?, ?, ?> archetype) { - if (getTypeNr() != archetype.getArchTypNr()) { + if (typenr != archetype.getArchTypNr()) { return false; } - if (getTypeAttr() == null) { + if (typeAttributes == null) { // no type-attributes, so we only compared type-numbers return true; } // check if all the type-attributes match - final int numArgs = getTypeAttr().length / 2; + final int numArgs = typeAttributes.length / 2; if (log.isDebugEnabled()) { - log.debug("# type: " + getTypeName()); + log.debug("# type: " + typeName); } for (int t = 0, l = numArgs * 2; t < l; t += 2) { - final String attrValue = archetype.getAttributeString(getTypeAttr()[t]); + final String attrValue = archetype.getAttributeString(typeAttributes[t]); if (log.isDebugEnabled()) { - log.debug(" arch: '" + attrValue + "', type: '" + getTypeAttr()[t + 1] + "'"); + log.debug(" arch: '" + attrValue + "', type: '" + typeAttributes[t + 1] + "'"); } - if (!attrValue.equals(getTypeAttr()[t + 1]) && !(getTypeAttr()[t + 1].equals("0") && attrValue.length() == 0)) { + if (!attrValue.equals(typeAttributes[t + 1]) && !(typeAttributes[t + 1].equals("0") && attrValue.length() == 0)) { if (log.isDebugEnabled()) { - log.debug("-> attr: " + getTypeAttr()[t] + " NO match"); + log.debug("-> attr: " + typeAttributes[t] + " NO match"); } return false; } if (log.isDebugEnabled()) { - log.debug("-> attr: " + getTypeAttr()[t] + " YES match"); + log.debug("-> attr: " + typeAttributes[t] + " YES match"); } } Modified: trunk/src/app/net/sf/gridarta/data/AbstractNamedObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/data/AbstractNamedObject.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/data/AbstractNamedObject.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -62,7 +62,7 @@ /** {@inheritDoc} */ @Override public String toString() { - return getName() + "@" + getPath(); + return getName() + "@" + path; } } // class AbstractNamedObject Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -307,7 +307,7 @@ if (!queryArchetype || isArchetype() || !hasArchetype()) { result = ""; } else { - result = getArchetype().getAttributeString(attributeName); + result = archetype.getAttributeString(attributeName); } } else { cacheAttributeValue(attributeName, result); @@ -433,7 +433,7 @@ */ public void setAttributeString(@NotNull final String attributeName, @NotNull final String value) { final String attributeNameWithSpace = attributeName.trim() + " "; // attributeName must be followed by space - final boolean sameAsInArchetype = hasArchetype() && getArchetype().getAttributeString(attributeName).equals(value); + final boolean sameAsInArchetype = hasArchetype() && archetype.getAttributeString(attributeName).equals(value); boolean exists = false; final StringBuilder result = new StringBuilder(); for (final String line : patternEndOfLine.split(getObjectText(), 0)) { @@ -620,7 +620,6 @@ * @param node GameObject to append */ public void insertBefore(@NotNull final G node) { - final GameObjectContainer<G, A, R> container = getContainer(); if (container == null) { throw new NotInsideContainerException(this); } @@ -632,7 +631,6 @@ * @param node GameObject to append */ public void insertAfter(@NotNull final G node) { - final GameObjectContainer<G, A, R> container = getContainer(); if (container == null) { throw new NotInsideContainerException(this); } @@ -669,7 +667,7 @@ * archetype */ public boolean hasUndefinedArchetype() { - return getArchetype().isUndefinedArchetype(); + return archetype.isUndefinedArchetype(); } /** @@ -1108,7 +1106,6 @@ */ @NotNull public String getBestName() { - final R archetype = getArchetype(); final String archObjName = archetype.getObjName(); if (objName != null && objName.length() > 0) { assert objName != null; @@ -1483,7 +1480,7 @@ resetObjectText(); // if no type was set, zero is taken - if (getArchTypNr() == TYPE_UNSET) { + if (archType == TYPE_UNSET) { setArchTypNr(0); } Modified: trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObject.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObject.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -138,7 +138,7 @@ /** {@inheritDoc} */ @Nullable public ImageIcon getDisplayIcon() { - return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); + return FaceObjectProviders.normal.getImageIconForFacename(faceName); } /** @@ -149,7 +149,7 @@ public int compareTo(final NamedObject o) { if (o instanceof FaceObject) { final FaceObject other = (FaceObject) o; - final boolean iAmBug = getName().equals("bug.111") || getName().equals("bug.101"); + final boolean iAmBug = faceName.equals("bug.111") || faceName.equals("bug.101"); final boolean otherIsBug = other.getName().equals("bug.111") || other.getName().equals("bug.101"); if (iAmBug && otherIsBug) { return 0; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -202,9 +202,9 @@ */ @NotNull public List<G> getSelectedGameObjects() { - final List<MapSquare<G, A, R>> selectedMapSquares = getMapViewBasic().getSelectedSquares(); + final List<MapSquare<G, A, R>> selectedMapSquares = mapViewBasic.getSelectedSquares(); if (selectedMapSquares.isEmpty()) { - return getMapControl().getAllGameObjects(); + return mapControl.getAllGameObjects(); } final List<G> objects = new ArrayList<G>(); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -206,7 +206,7 @@ @Nullable public MapSquare<G, A, R> getCursorSquare() { try { - return mapModel.getMapSquare(getMapCursor().getLocation()); + return mapModel.getMapSquare(mapCursor.getLocation()); } catch (final ArrayIndexOutOfBoundsException e) { return null; } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -190,7 +190,7 @@ * <code>false</code> otherwise */ private boolean isAddNewPickmapEnabled() { - return !isLockAllPickmaps(); + return !lockAllPickmaps; } /** @@ -200,7 +200,7 @@ */ @Nullable private Pickmap<G, A, R, V> getOpenPickmapMap() { - if (isLockAllPickmaps() || !active) { + if (lockAllPickmaps || !active) { return null; } return currentPickmap; @@ -213,7 +213,7 @@ */ @Nullable private Pickmap<G, A, R, V> getDeletePickmap() { - if (isLockAllPickmaps() || !active) { + if (lockAllPickmaps || !active) { return null; } return currentPickmap; @@ -226,7 +226,7 @@ */ @Nullable private Pickmap<G, A, R, V> getSavePickmap() { - if (isLockAllPickmaps() || !active) { + if (lockAllPickmaps || !active) { return null; } @@ -244,7 +244,7 @@ */ @Nullable private Pickmap<G, A, R, V> getRevertPickmap() { - if (isLockAllPickmaps() || !active) { + if (lockAllPickmaps || !active) { return null; } @@ -329,7 +329,7 @@ } this.lockAllPickmaps = lockAllPickmaps; - prefs.putBoolean(PICKMAPS_LOCKED, isLockAllPickmaps()); + prefs.putBoolean(PICKMAPS_LOCKED, this.lockAllPickmaps); refresh(); } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -241,7 +241,7 @@ /** {@inheritDoc} */ public boolean isPlainSaveEnabled() { - return mapFile != null && !getMapFileName().equals(CommonConstants.DEF_MAPFNAME); + return mapFile != null && !mapFileName.equals(CommonConstants.DEF_MAPFNAME); } /** {@inheritDoc} */ @@ -418,13 +418,13 @@ /** {@inheritDoc} */ public void save() { - if (isPickmap()) { - mainControl.getMainView().getStatusBar().setStatusText("Saving pickmap '" + getMapFileName() + "'..."); + if (isPickmap) { + mainControl.getMainView().getStatusBar().setStatusText("Saving pickmap '" + mapFileName + "'..."); } else { - mainControl.getMainView().getStatusBar().setStatusText("Saving map '" + getMapFileName() + "'..."); + mainControl.getMainView().getStatusBar().setStatusText("Saving map '" + mapFileName + "'..."); } assert mapFile != null; - if (isModified()) { + if (modified) { mapModel.getMapArchObject().updateModifiedAttribute(); } if (!encodeMapFile(mapFile)) { @@ -447,7 +447,7 @@ /** {@inheritDoc} */ public void repaint() { - for (final MapView<G, A, R, V> mapView : getMapViewFrames()) { + for (final MapView<G, A, R, V> mapView : mapViews) { mapView.getMapViewBasic().getRenderer().forceRepaint(); } } Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -153,7 +153,7 @@ */ public void setCaretPosition(final int pos) { caretPos = pos; - getMenu().requestFocus(); + menu.requestFocus(); ScriptEditControl.registerActivePopup(this); } Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -196,7 +196,7 @@ addFocusListener(new FocusHandler()); // Load the defaults - setInputHandler(defaults.getInputHandler()); + inputHandler = defaults.getInputHandler(); setDocument(defaults.getDocument()); editable = defaults.getEditable(); caretVisible = defaults.getCaretVisible(); @@ -266,7 +266,7 @@ */ @Override public void setFont(final Font f) { - getPainter().setFont(f); + painter.setFont(f); } /** Returns the object responsible for painting this text area. */ Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -260,8 +260,8 @@ /** Creates a new LineInfo object with the specified parameters. */ public LineInfo(final byte token, final Object obj) { - setToken(token); - setObj(obj); + this.token = token; + this.obj = obj; } /** The id of the last token of the line. */ Modified: trunk/src/app/net/sf/gridarta/treasurelist/TreasureTreeNode.java =================================================================== --- trunk/src/app/net/sf/gridarta/treasurelist/TreasureTreeNode.java 2008-07-25 19:47:18 UTC (rev 4430) +++ trunk/src/app/net/sf/gridarta/treasurelist/TreasureTreeNode.java 2008-07-25 20:02:53 UTC (rev 4431) @@ -58,7 +58,7 @@ */ public TreasureTreeNode getClone(final boolean processSecondLinking, @Nullable final List<TreasureTreeNode> needSecondLink) { // clone this object - final TreasureTreeNode clone = new TreasureTreeNode(getTreasureObj()); + final TreasureTreeNode clone = new TreasureTreeNode(content); // also clone all children nodes and link them properly for (final Enumeration<TreasureTreeNode> clist = children(); clist.hasMoreElements();) { @@ -66,7 +66,7 @@ } // if this is a list without children it will need second linking - if (!processSecondLinking && getTreasureObj().isTreasureList() && !getTreasureObj().getName().equalsIgnoreCase("NONE") && !getTreasureObj().hasLoop()) { + if (!processSecondLinking && content.isTreasureList() && !content.getName().equalsIgnoreCase("NONE") && !content.hasLoop()) { // this is a list, let's see if there are children if (!children().hasMoreElements()) { // no children-nodes of any kind, needs second linking @@ -78,7 +78,7 @@ for (final Enumeration<TreasureTreeNode> clist = children(); clist.hasMoreElements() && !hasChildren;) { // check for real children, other than YES/NO objects - final TreasureObj content = clist.nextElement().getTreasureObj(); + final TreasureObj content = clist.nextElement().content; if (content.getType() != TreasureObj.YES && content.getType() != TreasureObj.NO) { hasChildren = true; // found a real child } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:08:08
|
Revision: 4433 http://gridarta.svn.sourceforge.net/gridarta/?rev=4433&view=rev Author: akirschbaum Date: 2008-07-25 20:08:14 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Make methods static. Modified Paths: -------------- trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-07-25 20:06:14 UTC (rev 4432) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-07-25 20:08:14 UTC (rev 4433) @@ -371,7 +371,7 @@ } } - public boolean isScriptValid(final String code) { + public static boolean isScriptValid(final String code) { return true; } Modified: trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java 2008-07-25 20:06:14 UTC (rev 4432) +++ trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java 2008-07-25 20:08:14 UTC (rev 4433) @@ -67,7 +67,7 @@ } @Before - public void deactivateCursor() { + public static void deactivateCursor() { cursor.deactivate(); assertFalse("MapCursor should be deactivated", cursor.isActive()); changedPosCounter = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |