From: <aki...@us...> - 2008-08-13 23:03:45
|
Revision: 4827 http://gridarta.svn.sourceforge.net/gridarta/?rev=4827&view=rev Author: akirschbaum Date: 2008-08-13 23:03:50 +0000 (Wed, 13 Aug 2008) Log Message: ----------- Make "Scripts" tab in game object attributes panel work again. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-08-12 20:24:04 UTC (rev 4826) +++ trunk/crossfire/ChangeLog 2008-08-13 23:03:50 UTC (rev 4827) @@ -1,3 +1,7 @@ +2008-08-14 Andreas Kirschbaum + + * Make "Scripts" tab in game object attributes panel work again. + 2008-08-11 Andreas Kirschbaum * Fix crash due to reverted pickmaps. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-08-12 20:24:04 UTC (rev 4826) +++ trunk/daimonin/ChangeLog 2008-08-13 23:03:50 UTC (rev 4827) @@ -1,3 +1,7 @@ +2008-08-14 Andreas Kirschbaum + + * Make "Scripts" tab in game object attributes panel work again. + 2008-08-11 Andreas Kirschbaum * Fix crash due to reverted pickmaps. Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java 2008-08-12 20:24:04 UTC (rev 4826) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java 2008-08-13 23:03:50 UTC (rev 4827) @@ -120,6 +120,7 @@ /** {@inheritDoc} */ @Override protected void refresh(@Nullable final G gameObject) { + selectedGameObject = gameObject; if (gameObject == null || !gameObject.isScripted()) { setTabColor(TAB_COLOR_DEFAULT); if (eventList.getModel() != null && eventList.getModel().getSize() > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 12:28:41
|
Revision: 4828 http://gridarta.svn.sourceforge.net/gridarta/?rev=4828&view=rev Author: akirschbaum Date: 2008-08-15 12:28:45 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move MainControl.getLocalMapDir() to MapManager.getLocalMapDir(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/MapManager.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -233,7 +233,7 @@ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); globalSettings.readGlobalSettings(); - ScriptArchEditor.setGlobalSettings(globalSettings, this); + ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); @@ -334,12 +334,12 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter, globalSettings, this); + AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter, globalSettings, mapManager); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, 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 GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel = new GameObjectAttributesModel<GameObject, MapArchObject, Archetype>(); - gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); + gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -24,7 +24,7 @@ import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; @@ -254,8 +254,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<GameObject, MapArchObject, Archetype> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<GameObject, MapArchObject, Archetype> mapanel, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mapManager, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -27,7 +27,7 @@ import javax.swing.JDialog; import javax.swing.JList; import javax.swing.JOptionPane; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; import org.apache.log4j.Logger; @@ -118,10 +118,10 @@ * @param task ID number for task (open script/ edit path/ remove) * @param panelList JList from the MapArchPanel (script tab) which displays * the events - * @param mainControl the main control instance + * @param mapManager the map manager instance * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -140,7 +140,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == ScriptTab.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(mainControl, event.getScriptPath(), parent); + ScriptedEventEditor.openScript(mapManager, event.getScriptPath(), parent); } else if (task == ScriptTab.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event, parent); } else if (task == ScriptTab.SCRIPT_REMOVE) { Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -28,7 +28,7 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -49,7 +49,7 @@ * The main control instance. */ @Nullable - private static MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + private static MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager = null; /** * The global settings instance. @@ -57,9 +57,9 @@ @Nullable private static GlobalSettings globalSettings = null; - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { ScriptArchEditor.globalSettings = globalSettings; - ScriptArchEditor.mainControl = mainControl; + ScriptArchEditor.mapManager = mapManager; } public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { @@ -68,7 +68,7 @@ final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); - final File localMapDir = mainControl.getLocalMapDir(); + final File localMapDir = mapManager.getLocalMapDir(); scriptArchData.setChanged(false); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -24,7 +24,6 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import java.awt.Frame; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -58,11 +57,11 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesControl(final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { + public GameObjectAttributesControl(final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { super(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareControl); addTab(new ArchTab(archetypeTypeSet, gameObjectAttributesModel, gameObjectTextEditor)); addTab(new MsgTextTab<GameObject, MapArchObject, Archetype>(gameObjectAttributesModel)); - addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mainControl, gameObjectAttributesModel)); + addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mapManager, gameObjectAttributesModel)); addTab(new AnimationTab<GameObject, MapArchObject, Archetype>(animationObjects, gameObjectAttributesModel)); addTab(new ConnectionsTab<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, gameObjectAttributesModel)); addTab(new LockedItemsTab<GameObject, MapArchObject, Archetype>(lockedItemsControl, gameObjectAttributesModel)); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -293,7 +293,7 @@ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); globalSettings.readGlobalSettings(); - ScriptArchEditor.setGlobalSettings(globalSettings, this); + ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); @@ -400,12 +400,12 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter, globalSettings, this); + AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter, globalSettings, mapManager); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, 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 GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel = new GameObjectAttributesModel<GameObject, MapArchObject, Archetype>(); - gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); + gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -25,7 +25,7 @@ import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; @@ -401,8 +401,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<GameObject, MapArchObject, Archetype> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<GameObject, MapArchObject, Archetype> mapanel, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mapManager, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -27,7 +27,7 @@ import javax.swing.JDialog; import javax.swing.JList; import javax.swing.JOptionPane; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; import org.apache.log4j.Logger; @@ -118,9 +118,10 @@ * @param task ID number for task (open script/ edit path/ remove) * @param panelList JList from the MapArchPanel (script tab) which displays * the events + * @param mapManager the map manager instance * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -139,7 +140,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == ScriptTab.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(mainControl, event.getScriptPath(), parent); + ScriptedEventEditor.openScript(mapManager, event.getScriptPath(), parent); } else if (task == ScriptTab.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event, parent); } else if (task == ScriptTab.SCRIPT_REMOVE) { Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -28,7 +28,7 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -55,11 +55,11 @@ * The main control instance. */ @Nullable - private static MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + private static MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager = null; - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { ScriptArchEditor.globalSettings = globalSettings; - ScriptArchEditor.mainControl = mainControl; + ScriptArchEditor.mapManager = mapManager; } public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { @@ -68,7 +68,7 @@ final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); - final File localMapDir = mainControl.getLocalMapDir(); + final File localMapDir = mapManager.getLocalMapDir(); scriptArchData.setChanged(false); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -24,7 +24,6 @@ import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import java.awt.Frame; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -58,11 +57,11 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype>gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { + public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype>gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { super(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareControl); addTab(new ArchTab(archetypeTypeSet, gameObjectAttributesModel, gameObjectTextEditor)); addTab(new MsgTextTab<GameObject, MapArchObject, Archetype>(gameObjectAttributesModel)); - addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mainControl, gameObjectAttributesModel)); + addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mapManager, gameObjectAttributesModel)); addTab(new AnimationTab<GameObject, MapArchObject, Archetype>(animationObjects, gameObjectAttributesModel)); addTab(new ConnectionsTab<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, gameObjectAttributesModel)); addTab(new LockedItemsTab<GameObject, MapArchObject, Archetype>(lockedItemsControl, gameObjectAttributesModel)); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -35,7 +35,6 @@ 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 net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.ActionFactory; @@ -108,7 +107,7 @@ */ protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings) { this.globalSettings = globalSettings; - final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory); + final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); tmpMapManager.setEditTypes(editTypes); mapManager = tmpMapManager; @@ -132,22 +131,6 @@ } - /** {@inheritDoc} */ - public File getLocalMapDir() { - final MapControl<G, A, R, V> mapControl = mapManager.getCurrentMap(); - if (mapControl == null) { - return globalSettings.getMapDir(); - } - - final File mapFile = mapControl.getMapFile(); - if (mapFile == null) { - ACTION_FACTORY.showMessageDialog(getMainView(), "createNewEventNoMapPath"); - return globalSettings.getMapDir(); - } - - return mapFile.getParentFile(); - } - public static String getBuildNumberAsString() { try { return ResourceBundle.getBundle("build").getString("build.number"); Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -58,6 +58,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** * The gridarta objects factory instance. */ @NotNull @@ -84,8 +90,10 @@ * @param mainControl the main control * @param key The action factory key. * @param gridartaObjectsFactory the gridarta objects factory instance + * @param globalSettings the global settings instance */ - public DefaultMapManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final String key, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) { + public DefaultMapManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final String key, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings) { + this.globalSettings = globalSettings; actionFactory = ActionFactory.getFactory(key); this.mainControl = mainControl; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -462,4 +470,20 @@ } } + /** {@inheritDoc} */ + public File getLocalMapDir() { + final MapControl<G, A, R, V> mapControl = currentMap; + if (mapControl == null) { + return globalSettings.getMapDir(); + } + + final File mapFile = mapControl.getMapFile(); + if (mapFile == null) { + actionFactory.showMessageDialog(mainControl.getMainView(), "createNewEventNoMapPath"); + return globalSettings.getMapDir(); + } + + return mapFile.getParentFile(); + } + } // class DefaultMapManager Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -19,7 +19,6 @@ package net.sf.gridarta; -import java.io.File; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.MainView; @@ -101,10 +100,4 @@ */ ObjectChooser<G, A, R> getObjectChooser(); - /** - * Returns a guess for a script directory to use. - * @return the directory - */ - File getLocalMapDir(); - } // interface MainControl Modified: trunk/src/app/net/sf/gridarta/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapManager.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/MapManager.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -193,4 +193,10 @@ */ void revert(MapControl<G, A, R, V> mapControl); + /** + * Returns a guess for a script directory to use. + * @return the directory + */ + File getLocalMapDir(); + } // interface MapManager Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -24,7 +24,7 @@ import java.util.Map; import java.util.regex.Pattern; import javax.swing.JList; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.match.GameObjectMatchers; @@ -1364,11 +1364,11 @@ * @param eventList JList from the MapArchPanel (script tab) which displays * the events * @param mapanel the MapArchPanel - * @param mainControl the main control instance + * @param mapManager the map manager instance * @param parent the parent frame for dialog boxes * @xxx this method knows things it should never know, it is evil! */ - public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<G, A, R> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent); + public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<G, A, R> mapanel, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent); /** * A popup is opened and the user can create a new scripting event which Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -39,7 +39,7 @@ import javax.swing.WindowConstants; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.GameObject; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -59,8 +59,11 @@ @NotNull private static GlobalSettings globalSettings; + /** + * The map manager instance to use. + */ @NotNull - private static MainControl<?, ?, ?, ?> mainControl; + private static MapManager<?, ?, ?, ?> mapManager; protected static JComboBox pluginNameBox; @@ -85,8 +88,9 @@ * @param name the default event type * @param eventTypeBox the <code>JComboBox</code> containing all event * types + * @param mapManager the map manager instance to use */ - public static synchronized void initEventTypeBoxes(final String scriptEnding, final String name, final JComboBox eventTypeBox, @NotNull final FileFilter scriptFileFilter, @NotNull final GlobalSettings globalSettings, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public static synchronized void initEventTypeBoxes(final String scriptEnding, final String name, final JComboBox eventTypeBox, @NotNull final FileFilter scriptFileFilter, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<?, ?, ?, ?> mapManager) { AbstractScriptArchEditor.scriptEnding = scriptEnding; pluginNameBox = new JComboBox(new String[] {name}); @@ -95,7 +99,7 @@ AbstractScriptArchEditor.eventTypeBox = eventTypeBox; AbstractScriptArchEditor.scriptFileFilter = scriptFileFilter; AbstractScriptArchEditor.globalSettings = globalSettings; - AbstractScriptArchEditor.mainControl = mainControl; + AbstractScriptArchEditor.mapManager = mapManager; } /** @@ -109,7 +113,7 @@ public static <G extends GameObject<G, ?, ?>> void addEventScript(final G gameObject, final ScriptArchData<G> scriptArchData, @NotNull final Frame parent) { final String archName = gameObject.getBestName(); // create a reasonable default script name for lazy users :-) - final String defScriptName = ScriptUtils.chooseDefaultScriptName(mainControl.getLocalMapDir(), archName, scriptEnding); + final String defScriptName = ScriptUtils.chooseDefaultScriptName(mapManager.getLocalMapDir(), archName, scriptEnding); if (newScriptFrame == null) { // initialize popup frame @@ -153,7 +157,7 @@ browseb.setMargin(new Insets(0, 10, 0, 10)); browseb.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - final File home = mainControl.getLocalMapDir(); + final File home = mapManager.getLocalMapDir(); final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Select Script File"); @@ -165,7 +169,7 @@ if (fileChooser.showOpenDialog(newScriptFrame) == JFileChooser.APPROVE_OPTION) { // user has selected a file final File f = fileChooser.getSelectedFile(); - inputScriptPath.setText(ScriptUtils.localizeEventPath(mainControl.getLocalMapDir(), f, new File(globalSettings.getMapDefaultFolder()))); + inputScriptPath.setText(ScriptUtils.localizeEventPath(mapManager.getLocalMapDir(), f, new File(globalSettings.getMapDefaultFolder()))); } } }); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -33,7 +33,7 @@ import javax.swing.JTextField; import javax.swing.WindowConstants; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -78,11 +78,11 @@ /** * Opens the script pad to display a script. - * @param mainControl the main control instance + * @param mapManager the map manager instance * @param scriptPath the script path * @param parent the parent component for dialog boxes */ - public static void openScript(@NotNull final MainControl<?, ?, ?, ?> mainControl, final String scriptPath, @NotNull final Component parent) { + public static void openScript(@NotNull final MapManager<?, ?, ?, ?> mapManager, final String scriptPath, @NotNull final Component parent) { // trying to get the absolute path to scriptfile: final StringBuilder tmpPath = new StringBuilder(); if (scriptPath.startsWith("/")) { @@ -91,7 +91,7 @@ tmpPath.append(scriptPath); } else { // file path is relative to map dir - final String mapPath = mainControl.getLocalMapDir().getAbsolutePath(); + final String mapPath = mapManager.getLocalMapDir().getAbsolutePath(); tmpPath.append(mapPath); if (!mapPath.endsWith("/")) { tmpPath.append('/'); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ScriptTab.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -12,7 +12,7 @@ import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.border.EtchedBorder; -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.map.MapArchObject; @@ -46,10 +46,10 @@ private final Frame parent; /** - * The main control. + * The map manager. */ @NotNull - private final MainControl<G, A, R, ?> mainControl; + private final MapManager<G, A, R, ?> mapManager; private final Action aScriptAddNew = ACTION_FACTORY.createAction(false, "scriptAddNew", this); @@ -70,13 +70,13 @@ /** * Creates a new instance. * @param parent the parent frame for dialog boxes - * @param mainControl the main control + * @param mapManager the map manager * @param gameObjectAttributesModel the model to track */ - public ScriptTab(@NotNull final Frame parent, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel) { + public ScriptTab(@NotNull final Frame parent, @NotNull final MapManager<G, A, R, ?> mapManager, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel) { super(gameObjectAttributesModel); this.parent = parent; - this.mainControl = mainControl; + this.mapManager = mapManager; refresh(gameObjectAttributesModel.getSelectedGameObject()); } @@ -203,7 +203,7 @@ final MapSquare<G, A, R> mapSquare = selectedGameObject.getMapSquare(); assert mapSquare != null; mapSquare.getMapModel().beginTransaction("Modify event script"); - selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl, parent); + selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mapManager, parent); mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-13 23:03:50 UTC (rev 4827) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 12:28:45 UTC (rev 4828) @@ -386,7 +386,7 @@ final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); - final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory); + final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); @@ -785,7 +785,7 @@ } /** {@inheritDoc} */ - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<TestGameObject, TestMapArchObject, TestArchetype> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final ScriptTab<TestGameObject, TestMapArchObject, TestArchetype> mapanel, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final Frame parent) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 16:47:29
|
Revision: 4832 http://gridarta.svn.sourceforge.net/gridarta/?rev=4832&view=rev Author: akirschbaum Date: 2008-08-15 16:47:30 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Rename method names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.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/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -104,7 +104,7 @@ fromSelect.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { try { - final Archetype ao = archComboBoxModel.getNearsetMatch(objectChooser.getObjectChooserHighlight().getArchetypeName()); + final Archetype ao = archComboBoxModel.getNearsetMatch(objectChooser.getSelection().getArchetypeName()); archComboBox.setSelectedItem(ao); setItem(ao); } catch (final Exception ex) {//null pointer exception Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -504,7 +504,7 @@ * @param insertionMode the insertion mode to use */ private void fillWanted(@NotNull final MapView<G, A, R, V> mapView, @NotNull final InsertionMode insertionMode) { - copyBuffer.fill(mapView, insertionMode, objectChooser.getObjectChooserSelection(), -1); + copyBuffer.fill(mapView, insertionMode, objectChooser.getSelections(), -1); } /** "Random fill above" was selected from the Edit menu. */ @@ -532,7 +532,7 @@ final StringBuilder title = new StringBuilder("Random fill "); title.append(insertionMode); title.append(" "); - final G arch = objectChooser.getObjectChooserHighlight(); + final G arch = objectChooser.getSelection(); MapControl<G, A, R, V> pickmap = null; /* if we have a single arch, use it as random seed. @@ -555,7 +555,7 @@ final int rand = getFillDensity(title.toString()); if (rand >= 0) { - copyBuffer.fill(mapView, insertionMode, pickmap == null ? objectChooser.getObjectChooserSelection() : pickmap.getMapViewFrame().getSelectedGameObjects(), rand); + copyBuffer.fill(mapView, insertionMode, pickmap == null ? objectChooser.getSelections() : pickmap.getMapViewFrame().getSelectedGameObjects(), rand); } } @@ -590,7 +590,7 @@ public void floodfill() { final MapView<G, A, R, V> mapView = getFloodfillEnabled(); if (mapView != null) { - copyBuffer.floodfill(mapView, objectChooser.getObjectChooserSelection()); + copyBuffer.floodfill(mapView, objectChooser.getSelections()); } } Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -140,8 +140,8 @@ * @param mapView map view of the active map where the action was invoked */ public void display(final MapView<G, A, R, V> mapView) { - replaceArch = objectChooser.getObjectChooserHighlight(); // highlighted arch - replacePickmap = objectChooser.getObjectChooserSelection(); // selected arches + replaceArch = objectChooser.getSelection(); // highlighted arch + replacePickmap = objectChooser.getSelections(); // selected arches replaceCopyBuffer = copyBuffer.getCopyMapCtrl().getAllGameObjects(); if (!isBuilt) { @@ -406,7 +406,7 @@ switch (selectedIndex) { case 0: // replace with arch - replaceArch = objectChooser.getObjectChooserHighlight(); // selected arch + replaceArch = objectChooser.getSelection(); // selected arch updateArchSelection(replaceArch, true); break; @@ -422,7 +422,7 @@ case 2: // replace with pickmap - replacePickmap = objectChooser.getObjectChooserSelection(); // selected arches + replacePickmap = objectChooser.getSelections(); // selected arches iconLabel.setIcon(null); size = replacePickmap.size(); rfArchName.setText(String.valueOf(size)); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -391,7 +391,7 @@ */ @ActionMethod public void mapArchAddInv() { - final G arch = objectChooser.getObjectChooserHighlight(); + final G arch = objectChooser.getSelection(); if (arch == null) { // nothing selected? return; } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -185,7 +185,7 @@ default: throw new AssertionError(); } - copyBuffer.fill(e.getMapView(), insertionMode, objectChooser.getObjectChooserSelection(), -1); + copyBuffer.fill(e.getMapView(), insertionMode, objectChooser.getSelections(), -1); } } Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -176,13 +176,13 @@ /** {@inheritDoc} */ @Nullable - public G getObjectChooserHighlight() { + public G getSelection() { return pickmapActive ? pickmapChooserControl.getSelection() : (G) archetypeChooserControl.getSelection(); } /** {@inheritDoc} */ @NotNull - public List<G> getObjectChooserSelection() { + public List<G> getSelections() { return pickmapActive ? pickmapChooserControl.getSelections() : archetypeChooserControl.getSelections(); } Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -57,7 +57,7 @@ * @return the active arch in the left-side panel */ @Nullable - G getObjectChooserHighlight(); + G getSelection(); /** * Returns the selected arches in the left-side panel. This can either be @@ -67,7 +67,7 @@ * @return the selected arches in the left-side panel */ @NotNull - List<G> getObjectChooserSelection(); + List<G> getSelections(); /** * Select an archetype in the archetype chooser. If necessary, activates Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-15 16:40:55 UTC (rev 4831) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-15 16:47:30 UTC (rev 4832) @@ -229,7 +229,7 @@ * @param index the list index to insert at */ private void insertGameObjectFromObjectChooser(@NotNull final MapView<G, A, R, V> mapView, final int index) { - final G gameObject = objectChooser.getObjectChooserHighlight(); + final G gameObject = objectChooser.getSelection(); if (gameObject == null) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 17:18:24
|
Revision: 4834 http://gridarta.svn.sourceforge.net/gridarta/?rev=4834&view=rev Author: akirschbaum Date: 2008-08-15 17:18:27 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Extract fill() and floodfill() from CopyBuffer to FillUtils. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/gui/MainActions.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 Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/FillUtils.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -346,7 +346,7 @@ ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); - final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -407,7 +407,7 @@ final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel = new GameObjectAttributesModel<GameObject, MapArchObject, Archetype>(); gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); - final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -22,9 +22,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.util.HashSet; -import java.util.List; import java.util.Set; -import net.sf.gridarta.floodfill.Floodfill; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; @@ -35,7 +33,6 @@ import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapModelListener; import net.sf.gridarta.map.MapSquare; -import net.sf.gridarta.utils.RandomUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -236,63 +233,6 @@ } /** - * Executing the Fill command. - * @param mapView the map view to fill on - * @param insertionMode the insertion mode to use - * @param archList the game objects to fill with - * @param density the fill density in percent; -1 to disable - */ - public void fill(@NotNull final MapView<G, A, R, V> mapView, @NotNull final InsertionMode insertionMode, @NotNull final List<G> archList, final int density) { - if (archList.isEmpty()) { - return; - } - - if (mapView.getMapViewBasic().getMapGrid().getSelectedRec() == null) { - return; // should actually never happen - } - - mapView.getMapControl().getMapModel().beginTransaction("Fill"); // TODO; I18N/L10N - for (final Point p : mapView.getMapViewBasic().getSelection()) { - if (density != -1 && density != 100 && density < RandomUtils.rnd.nextInt(100) + 1) { - continue; - } - final G gameObject = archList.get(RandomUtils.rnd.nextInt(archList.size())); - mapView.getMapControl().getMapModel().addCopyToMap(gameObject, p, false, insertionMode); - } - mapView.getMapControl().getMapModel().endTransaction(); - } - - /** - * Floodfill the the map, starting at the cursor position. - * @param mapView the map view to fill - * @param archList the game objects to fill with - */ - public void floodfill(@NotNull final MapView<G, A, R, V> mapView, @NotNull final List<G> archList) { - final V mapViewBasic = mapView.getMapViewBasic(); - final Point cursor = mapViewBasic.getMapCursor().getLocation(); - if (cursor == null) { - return; - } - - final MapSquare<G, A, R> cursorSquare = mapViewBasic.getCursorSquare(); - if (cursorSquare == null || !cursorSquare.isEmpty()) { - return; - } - - if (archList.isEmpty()) { - return; - } - - final MapControl<G, A, R, V> mapControl = mapView.getMapControl(); - final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - mapModel.beginTransaction("Floodfill"); // TODO: I18N/L10N - //long start = System.currentTimeMillis(); - new Floodfill<G, A, R>().floodfill(mapControl, cursor.x, cursor.y, archList); - //mainControl.setStatusText("Flood fill took " + (System.currentTimeMillis() - start) + " milliseconds in " + iter + " iterations."); - mapModel.endTransaction(); - } - - /** * Returns mapControl for this CopyBuffer. * @return mapControl for this CopyBuffer. */ Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -38,6 +38,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.map.FillUtils; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; @@ -504,7 +505,7 @@ * @param insertionMode the insertion mode to use */ private void fillWanted(@NotNull final MapView<G, A, R, V> mapView, @NotNull final InsertionMode insertionMode) { - copyBuffer.fill(mapView, insertionMode, objectChooser.getSelections(), -1); + FillUtils.fill(mapView, insertionMode, objectChooser.getSelections(), -1); } /** "Random fill above" was selected from the Edit menu. */ @@ -531,7 +532,7 @@ private void fillRandomWanted(@NotNull final MapView<G, A, R, V> mapView, @NotNull final InsertionMode insertionMode) { final int rand = getFillDensity("Random fill"); if (rand >= 0) { - copyBuffer.fill(mapView, insertionMode, objectChooser.getSelections(), rand); + FillUtils.fill(mapView, insertionMode, objectChooser.getSelections(), rand); } } @@ -566,7 +567,7 @@ public void floodfill() { final MapView<G, A, R, V> mapView = getFloodfillEnabled(); if (mapView != null) { - copyBuffer.floodfill(mapView, objectChooser.getSelections()); + FillUtils.floodfill(mapView, objectChooser.getSelections()); } } Added: trunk/src/app/net/sf/gridarta/gui/map/FillUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/FillUtils.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/FillUtils.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -0,0 +1,117 @@ +/* + * 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.gui.map; + +import java.awt.Point; +import java.util.List; +import net.sf.gridarta.floodfill.Floodfill; +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; +import net.sf.gridarta.utils.RandomUtils; +import org.jetbrains.annotations.NotNull; + +/** + * Utility class implementing fill operations on map instances. + * @author Andreas Kirschbaum + */ +public class FillUtils { + + /** + * Private constructor to prevent instantiation. + */ + private FillUtils() { + } + + /** + * Executing the Fill command. + * @param mapView the map view to fill on + * @param insertionMode the insertion mode to use + * @param gameObjects the game objects to fill with + * @param density the fill density in percent; -1 to disable + */ + 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>> void fill(@NotNull final MapView<G, A, R, V> mapView, @NotNull final InsertionMode insertionMode, @NotNull final List<G> gameObjects, final int density) { + fill(mapView.getMapControl(), mapView.getMapViewBasic().getSelection(), insertionMode, gameObjects, density); + } + + /** + * Fills a set of tiles in a map. + * @param mapControl the map to fill + * @param selection the tiles to fill + * @param insertionMode the insertion mode to use + * @param gameObjects the game objects to fill with + * @param density the fill density in percent; -1 to disable + */ + 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>> void fill(@NotNull final MapControl<G, A, R, V> mapControl, @NotNull final Point[] selection, @NotNull final InsertionMode insertionMode, @NotNull final List<G> gameObjects, final int density) { + if (selection.length <= 0) { + return; + } + + if (gameObjects.isEmpty()) { + return; + } + + mapControl.getMapModel().beginTransaction("Fill"); // TODO; I18N/L10N + for (final Point p : selection) { + if (density != -1 && density != 100 && density < RandomUtils.rnd.nextInt(100) + 1) { + continue; + } + final G gameObject = gameObjects.get(RandomUtils.rnd.nextInt(gameObjects.size())); + mapControl.getMapModel().addCopyToMap(gameObject, p, false, insertionMode); + } + mapControl.getMapModel().endTransaction(); + } + + /** + * Floodfill the the map, starting at the cursor position. + * @param mapView the map view to fill + * @param gameObjects the game objects to fill with + */ + 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>> void floodfill(@NotNull final MapView<G, A, R, V> mapView, @NotNull final List<G> gameObjects) { + floodfill(mapView.getMapControl(), mapView.getMapViewBasic().getMapCursor().getLocation(), gameObjects); + } + + /** + * Floodfill the the map, starting at the cursor position. + * @param mapControl the map to fill + * @param start the starting location + * @param gameObjects the game objects to fill with + */ + 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>> void floodfill(@NotNull final MapControl<G, A, R, V> mapControl, @NotNull final Point start, @NotNull final List<G> gameObjects) { + if (gameObjects.isEmpty()) { + return; + } + + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + if (!mapModel.isPointValid(start) || !mapModel.getMapSquare(start).isEmpty()) { + return; + } + + mapModel.beginTransaction("Floodfill"); // TODO: I18N/L10N + //long start = System.currentTimeMillis(); + new Floodfill<G, A, R>().floodfill(mapControl, start.x, start.y, gameObjects); + //mainControl.setStatusText("Flood fill took " + (System.currentTimeMillis() - start) + " milliseconds in " + iter + " iterations."); + mapModel.endTransaction(); + } + +} // class FillUtils Property changes on: trunk/src/app/net/sf/gridarta/gui/map/FillUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -26,9 +26,9 @@ 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.map.FillUtils; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapViewBasic; @@ -92,12 +92,6 @@ 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; @@ -105,12 +99,10 @@ /** * 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, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser) { super("selection"); this.objectChooser = objectChooser; - this.copyBuffer = copyBuffer; selectionToolAutoFillChanged(); } @@ -185,7 +177,7 @@ default: throw new AssertionError(); } - copyBuffer.fill(e.getMapView(), insertionMode, objectChooser.getSelections(), -1); + FillUtils.fill(e.getMapView(), insertionMode, objectChooser.getSelections(), -1); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-15 16:49:42 UTC (rev 4833) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -25,7 +25,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; -import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.EditTypes; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -70,13 +69,12 @@ * @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 EditTypes<G, A, R, V> editTypes, @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) { + public ToolPalette(@NotNull final EditTypes<G, A, R, V> editTypes, @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", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + lmbSelector = new ToolSelector<G, A, R, V>("selection", editTypes, selectedSquareView, objectChooser, pickmapChooserControl); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", editTypes, selectedSquareView, objectChooser, pickmapChooserControl); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", editTypes, 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-08-15 16:49:42 UTC (rev 4833) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-15 17:18:27 UTC (rev 4834) @@ -32,7 +32,6 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.JToggleButton; -import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.EditTypes; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -92,11 +91,10 @@ * @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 EditTypes<G, A, R, V> editTypes, @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) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final EditTypes<G, A, R, V> editTypes, @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, copyBuffer), new DeletionTool<G, A, R, V>(editTypes, 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), new DeletionTool<G, A, R, V>(editTypes, 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-08-15 17:20:45
|
Revision: 4835 http://gridarta.svn.sourceforge.net/gridarta/?rev=4835&view=rev Author: akirschbaum Date: 2008-08-15 17:20:52 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Convert fields to local variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:18:27 UTC (rev 4834) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:20:52 UTC (rev 4835) @@ -181,15 +181,9 @@ /** The Spells. */ private final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells = new Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>>(); - /** The ArchetypeSet, which is a registry of all Archetypes. */ - private final ArchetypeSet archetypeSet; - /** The current script controller. */ private final ScriptController scriptControl; - /** The list of archtype-data (loaded from "types.xml"). */ - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; - /** The map validators. */ private final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators; @@ -205,13 +199,7 @@ /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - /** - * The {@link GameObjectAttributesDialogFactory} to use. - */ @NotNull - private final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; - - @NotNull private final GameObjectAttributesControl gameObjectAttributesControl; /** @@ -236,7 +224,7 @@ ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); + final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -247,9 +235,9 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, 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, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); + final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); + final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:18:27 UTC (rev 4834) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:20:52 UTC (rev 4835) @@ -223,15 +223,9 @@ /** The Spells. */ private final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells = new Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>>(); - /** The ArchetypeSet, which is a registry of all Archetypes. */ - private final ArchetypeSet archetypeSet; - /** Whether to display double arches like stacked walls in stacked version. */ private boolean drawDouble; - /** The list of archtype-data (loaded from "types.xml"). */ - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; - /** Client Control Component. */ private ProcessRunner controlClient; @@ -265,22 +259,10 @@ /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - /** - * The {@link GameObjectAttributesDialogFactory} to use. - */ @NotNull - private final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; - - @NotNull private final GameObjectAttributesControl gameObjectAttributesControl; /** - * The map view manager instance. - */ - @NotNull - private final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager; - - /** * The file control instance. */ @NotNull @@ -296,7 +278,7 @@ ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); + final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); @@ -310,12 +292,12 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, 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, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); + final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); + final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); - mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); + final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 17:23:01
|
Revision: 4836 http://gridarta.svn.sourceforge.net/gridarta/?rev=4836&view=rev Author: akirschbaum Date: 2008-08-15 17:23:07 +0000 (Fri, 15 Aug 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/MainActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:20:52 UTC (rev 4835) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:23:07 UTC (rev 4836) @@ -245,7 +245,7 @@ final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); SystemIcons.init(); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:20:52 UTC (rev 4835) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:23:07 UTC (rev 4836) @@ -302,7 +302,7 @@ final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); SystemIcons.init(); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 17:20:52 UTC (rev 4835) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 17:23:07 UTC (rev 4836) @@ -47,7 +47,6 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.objectchooser.ObjectChooser; -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; @@ -87,10 +86,6 @@ @NotNull private final CopyBuffer<G, A, R, V> copyBuffer; - /** The pickmap chooser control instance. */ - @NotNull - private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; - /** The animation objects instance to use. */ @NotNull private final AnimationObjects<?> animationObjects; @@ -312,7 +307,6 @@ * @param editTypes the edit types instance * @param archetypeSet the archetype set * @param copyBuffer the copy buffer instance - * @param pickmapChooserControl the pickmap chooser control instance to use * @param animationObjects the animation object instance to use * @param actionFactory The action factory to create actions. * @param faceObjects the FaceObjects instance to use @@ -320,13 +314,12 @@ * @param mapManager the map manager instance * @param mapViewManager the map view manager instance */ - public MainActions(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @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, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { + public MainActions(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { this.replaceDialogManager = replaceDialogManager; this.mainControl = mainControl; this.editTypes = editTypes; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; - this.pickmapChooserControl = pickmapChooserControl; this.animationObjects = animationObjects; this.actionFactory = actionFactory; this.faceObjects = faceObjects; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 18:10:31
|
Revision: 4840 http://gridarta.svn.sourceforge.net/gridarta/?rev=4840&view=rev Author: akirschbaum Date: 2008-08-15 18:10:38 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Reorder initialization code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 17:28:49 UTC (rev 4839) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:10:38 UTC (rev 4840) @@ -239,17 +239,17 @@ final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); + mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); + SystemIcons.init(); + createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); - mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); - SystemIcons.init(); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); - createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); gameObjectAttributesDialogFactory.setParent(mainView); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 17:28:49 UTC (rev 4839) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:10:38 UTC (rev 4840) @@ -296,17 +296,17 @@ final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); + final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); + SystemIcons.init(); + createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); - final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); - SystemIcons.init(); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); - createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); gameObjectAttributesDialogFactory.setParent(mainView); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 18:29:16
|
Revision: 4844 http://gridarta.svn.sourceforge.net/gridarta/?rev=4844&view=rev Author: akirschbaum Date: 2008-08-15 18:29:21 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code from CMainControl to DelegatingMapValidator. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/map/validation/DelegatingMapValidator.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:25:08 UTC (rev 4843) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:29:21 UTC (rev 4844) @@ -105,9 +105,7 @@ 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; import net.sf.gridarta.map.validation.DelegatingMapValidator; -import net.sf.gridarta.map.validation.ErrorCollector; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.ConnectedInsideContainerChecker; import net.sf.gridarta.map.validation.checks.ConnectedPickableChecker; @@ -455,9 +453,7 @@ /** {@inheritDoc} */ public void validateMap(final MapModel<GameObject, MapArchObject, Archetype> map) { - final ErrorCollector<GameObject, MapArchObject, Archetype> errorCollector = new DefaultErrorCollector<GameObject, MapArchObject, Archetype>(); - validators.validateAll(map, errorCollector); - map.setErrors(errorCollector); + validators.validateAll(map); } /** View Treasure Lists. */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:25:08 UTC (rev 4843) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:29:21 UTC (rev 4844) @@ -115,9 +115,7 @@ import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; -import net.sf.gridarta.map.validation.DefaultErrorCollector; import net.sf.gridarta.map.validation.DelegatingMapValidator; -import net.sf.gridarta.map.validation.ErrorCollector; import net.sf.gridarta.map.validation.checks.BlockedMobOrSpawnPointChecker; import net.sf.gridarta.map.validation.checks.BlockedSpawnPointChecker; import net.sf.gridarta.map.validation.checks.BlockedSquareChecker; @@ -575,9 +573,7 @@ /** {@inheritDoc} */ public void validateMap(final MapModel<GameObject, MapArchObject, Archetype> map) { - final ErrorCollector<GameObject, MapArchObject, Archetype> errorCollector = new DefaultErrorCollector<GameObject, MapArchObject, Archetype>(); - validators.validateAll(map, errorCollector); - map.setErrors(errorCollector); + validators.validateAll(map); } /** Control the client. */ Modified: trunk/src/app/net/sf/gridarta/map/validation/DelegatingMapValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/DelegatingMapValidator.java 2008-08-15 18:25:08 UTC (rev 4843) +++ trunk/src/app/net/sf/gridarta/map/validation/DelegatingMapValidator.java 2008-08-15 18:29:21 UTC (rev 4844) @@ -27,6 +27,7 @@ import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; +import org.jetbrains.annotations.NotNull; /** * A Map Validator that delegates to other MapValidators. @@ -56,9 +57,9 @@ /** * Perform all validations on a map. * @param mapModel map to validate - * @param errorCollector collector to report errors to */ - public void validateAll(final MapModel<G, A, R> mapModel, final ErrorCollector<G, A, R> errorCollector) { + public void validateAll(@NotNull final MapModel<G, A, R> mapModel) { + final ErrorCollector<G, A, R> errorCollector = new DefaultErrorCollector<G, A, R>(); validate(mapModel, errorCollector); for (final MapSquare<G, A, R> mapSquare : mapModel) { validate(mapSquare, errorCollector); @@ -69,6 +70,7 @@ } } } + mapModel.setErrors(errorCollector); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 18:36:56
|
Revision: 4845 http://gridarta.svn.sourceforge.net/gridarta/?rev=4845&view=rev Author: akirschbaum Date: 2008-08-15 18:37:00 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove MainControl.validateMap(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/map/AutoValidator.java trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -104,7 +104,6 @@ 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.DelegatingMapValidator; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.ConnectedInsideContainerChecker; @@ -246,7 +245,8 @@ final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); + validators = createMapValidators(); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); new About("cfeditor", mainView); @@ -379,8 +379,7 @@ } } recentManager.initRecent(); - validators = createMapValidators(); - new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(validators, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); fileControl = new FileControl(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, pythonFileFilter, newMapDialogFactory); } @@ -451,11 +450,6 @@ return mapValidators; } - /** {@inheritDoc} */ - public void validateMap(final MapModel<GameObject, MapArchObject, Archetype> map) { - validators.validateAll(map); - } - /** View Treasure Lists. */ @ActionMethod public void viewTreasurelists() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -303,7 +303,8 @@ final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); + validators = createMapValidators(); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); new About("daieditor", mainView); @@ -451,8 +452,7 @@ } } recentManager.initRecent(); - validators = createMapValidators(); - new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(validators, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); fileControl = new FileControl(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, luaFileFilter, newMapDialogFactory); } @@ -571,11 +571,6 @@ controlServer.showDialog(mainView); } - /** {@inheritDoc} */ - public void validateMap(final MapModel<GameObject, MapArchObject, Archetype> map) { - validators.validateAll(map); - } - /** Control the client. */ @ActionMethod public void controlClient() { Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -27,7 +27,6 @@ import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionMethod; import org.jetbrains.annotations.NotNull; @@ -85,12 +84,6 @@ /** Exits from the program. */ void doExit(); - /** - * Check a map. - * @param map the map to check - */ - void validateMap(final MapModel<G, A, R> map); - /** Invoked when the user wants to reload the images. */ void reloadFaces(); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -53,6 +53,7 @@ import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapModelEvent; import net.sf.gridarta.map.MapModelListener; +import net.sf.gridarta.map.validation.DelegatingMapValidator; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.misc.Progress; @@ -75,6 +76,10 @@ /** The MainControl. */ private final MainControl<G, A, R, V> mainControl; + /** The map validators. */ + @NotNull + private final DelegatingMapValidator<G, A, R> validators; + /** The edit types instance. */ @NotNull private final EditTypes<G, A, R, V> editTypes; @@ -304,6 +309,7 @@ * Create a new instance. * @param replaceDialogManager the replace dialog manager to use * @param mainControl the MainControl + * @param validators the map validators * @param editTypes the edit types instance * @param archetypeSet the archetype set * @param copyBuffer the copy buffer instance @@ -314,9 +320,10 @@ * @param mapManager the map manager instance * @param mapViewManager the map view manager instance */ - public MainActions(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { + public MainActions(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { this.replaceDialogManager = replaceDialogManager; this.mainControl = mainControl; + this.validators = validators; this.editTypes = editTypes; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; @@ -644,7 +651,7 @@ public void validateMap() { final MapModel<G, A, R> mapModel = getValidateMapEnabled(); if (mapModel != null) { - mainControl.validateMap(mapModel); + validators.validateAll(mapModel); } } Modified: trunk/src/app/net/sf/gridarta/map/AutoValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AutoValidator.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/src/app/net/sf/gridarta/map/AutoValidator.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -30,6 +30,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.validation.DelegatingMapValidator; import org.jetbrains.annotations.NotNull; /** @@ -141,17 +142,17 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param validators the map validators * @param mapManager the map manager to use * @param autoDefault Whether the auto-validator is enabled by default. */ - public AutoValidator(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V>mapManager, final boolean autoDefault) { + public AutoValidator(@NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final MapManager<G, A, R, V>mapManager, final boolean autoDefault) { setDefaultPreferencesValue(autoDefault); wasEnabled = isEnabled(); // call to isEnabled() must not happen before setDefaultPreferencesValue() prefs.addPreferenceChangeListener(preferenceChangeListener); - autoValidatorProcessor = new AutoValidatorProcessor<G, A, R, V>(mainControl, mapManager); + autoValidatorProcessor = new AutoValidatorProcessor<G, A, R, V>(validators, mapManager); mapManager.addMapManagerListener(mapManagerListener); autoValidatorProcessor.start(); Modified: trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -23,11 +23,11 @@ import java.lang.reflect.InvocationTargetException; import java.util.IdentityHashMap; import java.util.Map; -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.map.MapViewBasic; +import net.sf.gridarta.map.validation.DelegatingMapValidator; import org.jetbrains.annotations.NotNull; /** @@ -43,7 +43,7 @@ /** The main control. */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final DelegatingMapValidator<G, A, R> validators; /** * The map manager to use. @@ -79,7 +79,7 @@ synchronized (changedMapModels) { for (final MapModel<G, A, R> mapModel : changedMapModels.keySet()) { - mainControl.validateMap(mapModel); + validators.validateAll(mapModel); } changedMapModels.clear(); } @@ -89,11 +89,11 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param validators The main control. * @param mapManager the map manager to use */ - public AutoValidatorProcessor(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager) { - this.mainControl = mainControl; + public AutoValidatorProcessor(@NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final MapManager<G, A, R, V> mapManager) { + this.validators = validators; this.mapManager = mapManager; } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 18:29:21 UTC (rev 4844) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 18:37:00 UTC (rev 4845) @@ -446,11 +446,6 @@ } /** {@inheritDoc} */ - public void validateMap(final MapModel<TestGameObject, TestMapArchObject, TestArchetype> map) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public void reloadFaces() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 18:39:23
|
Revision: 4846 http://gridarta.svn.sourceforge.net/gridarta/?rev=4846&view=rev Author: akirschbaum Date: 2008-08-15 18:39:30 +0000 (Fri, 15 Aug 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/map/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:37:00 UTC (rev 4845) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:39:30 UTC (rev 4846) @@ -243,7 +243,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:37:00 UTC (rev 4845) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:39:30 UTC (rev 4846) @@ -301,7 +301,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-08-15 18:37:00 UTC (rev 4845) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-08-15 18:39:30 UTC (rev 4846) @@ -21,7 +21,6 @@ import javax.swing.Action; import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; @@ -150,11 +149,10 @@ * Create a new instance. * @param key the action factory key * @param mapCursorControl the map control for this instance - * @param mainControl the main control to query for current map changes * @param mapManager the map manager * @param mapViewManager the map view manager */ - public MapCursorActions(@NotNull final String key, @NotNull final MapCursorControl<G, A, R, V> mapCursorControl, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { + public MapCursorActions(@NotNull final String key, @NotNull final MapCursorControl<G, A, R, V> mapCursorControl, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager) { actionFactory = ActionFactory.getFactory(key); this.mapCursorControl = mapCursorControl; actionFactory.createActions(true, this, directionsGo); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-08-15 18:37:00 UTC (rev 4845) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-08-15 18:39:30 UTC (rev 4846) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map; import java.awt.Point; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -63,7 +62,6 @@ /** * Create a MapCursorControl. * @param key The action factory key. - * @param mainControl the main control * @param gameObjectAttributesDialogFactory the factory for creating game * object attributes dialog instances * @param mapManager the map manager @@ -71,12 +69,12 @@ * @param selectedSquareControl the selected square control * @param selectedSquareView the selected square view */ - public MapCursorControl(final String key, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + public MapCursorControl(final String key, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.selectedSquareControl = selectedSquareControl; this.selectedSquareView = selectedSquareView; goLocationDialogManager = new GoLocationDialogManager<G, A, R, V>(mapViewManager); - actions = new MapCursorActions<G, A, R, V>(key, this, mainControl, mapManager, mapViewManager); + actions = new MapCursorActions<G, A, R, V>(key, this, mapManager, mapViewManager); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 18:47:54
|
Revision: 4847 http://gridarta.svn.sourceforge.net/gridarta/?rev=4847&view=rev Author: akirschbaum Date: 2008-08-15 18:48:01 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove dependency ReplaceDialog -> MainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:39:30 UTC (rev 4846) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) @@ -233,13 +233,13 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); - final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:39:30 UTC (rev 4846) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) @@ -291,13 +291,13 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); - final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-15 18:39:30 UTC (rev 4846) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-15 18:48:01 UTC (rev 4847) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui; +import java.awt.Component; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ItemEvent; @@ -39,7 +40,6 @@ import javax.swing.JTextField; import javax.swing.WindowConstants; import net.sf.gridarta.CopyBuffer; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; @@ -76,7 +76,11 @@ /** Dialog. */ private final JDialog dialog; - private final MainControl<G, A, R, V> mainControl; + /** + * The parent component for dialogs. + */ + @NotNull + private final Component parent; /** The archetype set. */ @NotNull @@ -122,14 +126,14 @@ /** * Construct instance. - * @param mainControl MainControl + * @param parent the parent component for dialogs * @param copyBuffer the copy buffer instance */ - public ReplaceDialog(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { - dialog = createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("replaceTitle")); + public ReplaceDialog(@NotNull final Component parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { + dialog = createDialog(parent, ACTION_FACTORY.getString("replaceTitle")); dialog.setModal(false); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); - this.mainControl = mainControl; + this.parent = parent; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; @@ -233,7 +237,7 @@ setOptions(new Object[] {okButton, applyButton, cancelButton}); dialog.getRootPane().setDefaultButton(okButton); dialog.pack(); - dialog.setLocationRelativeTo(mainControl.getMainView()); + dialog.setLocationRelativeTo(parent); dialog.setVisible(true); isBuilt = true; } else { Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-15 18:39:30 UTC (rev 4846) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-15 18:48:01 UTC (rev 4847) @@ -1,7 +1,7 @@ package net.sf.gridarta.gui; +import java.awt.Component; import net.sf.gridarta.CopyBuffer; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; @@ -19,8 +19,11 @@ @Nullable private ReplaceDialog<G, A, R, V> instance = null; + /** + * The parent component for dialogs. + */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final Component parent; @NotNull private final ArchetypeSet<G, A, R> archetypeSet; @@ -31,8 +34,8 @@ @NotNull private ObjectChooser<G, A, R> objectChooser; - public ReplaceDialogManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { - this.mainControl = mainControl; + public ReplaceDialogManager(@NotNull final Component parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + this.parent = parent; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; } @@ -53,7 +56,7 @@ @NotNull public ReplaceDialog<G, A, R, V> getInstance() { if (instance == null) { - instance = new ReplaceDialog<G, A, R, V>(mainControl, archetypeSet, copyBuffer, objectChooser); + instance = new ReplaceDialog<G, A, R, V>(parent, archetypeSet, copyBuffer, objectChooser); } return instance; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:03:36
|
Revision: 4848 http://gridarta.svn.sourceforge.net/gridarta/?rev=4848&view=rev Author: akirschbaum Date: 2008-08-15 19:03:37 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove dependency WindowAction -> MainControl. 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/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -338,7 +338,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -44,6 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -82,6 +83,10 @@ @NotNull private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + /** The {@link EditTypes} instance to use. */ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; @@ -132,7 +137,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -172,14 +177,15 @@ /** {@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, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; + this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -393,7 +393,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -44,6 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -85,6 +86,10 @@ @NotNull private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + /** The {@link EditTypes} instance to use. */ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; @@ -132,7 +137,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -174,15 +179,16 @@ /** {@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, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; + this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -140,6 +141,7 @@ * @param archetypeChooserModel the archetype chooser model instance * @param selectedSquareView the selected square view instance * @param mainControl the main control instance + * @param mainView the main view instance * @param editTypes the edit types instance * @param mapImageCache the map image cache instance * @param mapActions the map actions instance @@ -148,6 +150,6 @@ * @param autojoinLists the autojoin lists instance * @param toolPalette the tool palette instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); + void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -28,10 +28,10 @@ import javax.swing.ImageIcon; import javax.swing.JInternalFrame; import javax.swing.JMenu; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.DefaultMapControl; @@ -147,21 +147,21 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param mainView the main view * @param mapControl the controller of this view * @param number Each view of a level will get a number * @param mapViewBasic The underlying mapview object. * @param actionFactory Action Factory to create Actions. * @param mapImageCache the map image cache instance */ - 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, @NotNull final MapImageCache<G, A, R, V> mapImageCache) { + public MapView(@NotNull final MainView<G, A, R, V> mainView, @NotNull final MapControl<G, A, R, V> mapControl, final int number, @NotNull final V mapViewBasic, @NotNull final ActionFactory actionFactory, @NotNull final MapImageCache<G, A, R, V> mapImageCache) { super(PathManager.getMapPath(mapControl.getMapFileName()) + " [ " + mapControl.getMapModel().getMapArchObject().getMapDisplayName() + " ] (" + number + ")" + (mapControl.isModified() ? " *" : ""), true, true, true, true); this.mapControl = mapControl; this.number = number; this.mapViewBasic = mapViewBasic; this.mapImageCache = mapImageCache; 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); + windowAction = new WindowAction<G, A, R, V>(mainView, this); mapControl.getMapModel().addMapModelListener(mapModelListener); mapControl.addMapControlListener(mapControlListener); getContentPane().setLayout(new BorderLayout()); Modified: trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -22,9 +22,9 @@ import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.KeyStroke; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -37,9 +37,11 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** The main control. */ + /** + * The main view. + */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final MainView<G, A, R, V> mainView; /** The associated map view. */ @NotNull @@ -47,11 +49,11 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param mainView the main view * @param mapView The associated map view. */ - public WindowAction(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapView<G, A, R, V> mapView) { - this.mainControl = mainControl; + public WindowAction(@NotNull final MainView<G, A, R, V> mainView, @NotNull final MapView<G, A, R, V> mapView) { + this.mainView = mainView; this.mapView = mapView; putValue(SHORT_DESCRIPTION, "Switches to map " + mapView.getTitle()); } @@ -75,7 +77,7 @@ /** {@inheritDoc} */ public void actionPerformed(final ActionEvent e) { - mainControl.getMainView().setCurrentLevelView(mapView); + mainView.setCurrentLevelView(mapView); } /** {@inheritDoc} */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -868,7 +868,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:05:42
|
Revision: 4849 http://gridarta.svn.sourceforge.net/gridarta/?rev=4849&view=rev Author: akirschbaum Date: 2008-08-15 19:05:39 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:05:39 UTC (rev 4849) @@ -217,7 +217,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); - globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:05:39 UTC (rev 4849) @@ -272,7 +272,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); - globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 19:05:39 UTC (rev 4849) @@ -113,6 +113,7 @@ mapManager = tmpMapManager; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory); this.gridartaObjectsFactory = gridartaObjectsFactory; + globalSettings.readGlobalSettings(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:17:08
|
Revision: 4850 http://gridarta.svn.sourceforge.net/gridarta/?rev=4850&view=rev Author: akirschbaum Date: 2008-08-15 19:17:15 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Merge redundant code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:05:39 UTC (rev 4849) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:17:15 UTC (rev 4850) @@ -26,7 +26,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gameobject.anim.AnimationObject; import cfeditor.gameobject.face.FaceObjects; -import cfeditor.gameobject.scripts.ScriptArchEditor; import cfeditor.gameobject.scripts.ScriptArchUtils; import cfeditor.gameobject.scripts.ScriptedEvent; import cfeditor.gui.GameObjectAttributesControl; @@ -217,7 +216,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); - ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 19:05:39 UTC (rev 4849) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 19:17:15 UTC (rev 4850) @@ -19,23 +19,16 @@ package cfeditor.gameobject.scripts; -import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; import java.io.File; import java.io.IOException; import javax.swing.JDialog; import javax.swing.JOptionPane; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class ScriptArchEditor extends AbstractScriptArchEditor { @@ -45,23 +38,6 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** - * The main control instance. - */ - @Nullable - private static MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager = null; - - /** - * The global settings instance. - */ - @Nullable - private static GlobalSettings globalSettings = null; - - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { - ScriptArchEditor.globalSettings = globalSettings; - ScriptArchEditor.mapManager = mapManager; - } - public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:05:39 UTC (rev 4849) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:17:15 UTC (rev 4850) @@ -272,7 +272,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); - ScriptArchEditor.setGlobalSettings(globalSettings, mapManager); ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 19:05:39 UTC (rev 4849) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-15 19:17:15 UTC (rev 4850) @@ -19,23 +19,16 @@ package daieditor.gameobject.scripts; -import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; -import daieditor.gui.map.CMapViewBasic; -import daieditor.map.MapArchObject; import java.io.File; import java.io.IOException; import javax.swing.JDialog; import javax.swing.JOptionPane; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class ScriptArchEditor extends AbstractScriptArchEditor { @@ -45,23 +38,6 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** - * The global settings instance. - */ - @Nullable - private static GlobalSettings globalSettings = null; - - /** - * The main control instance. - */ - @Nullable - private static MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager = null; - - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { - ScriptArchEditor.globalSettings = globalSettings; - ScriptArchEditor.mapManager = mapManager; - } - public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-15 19:05:39 UTC (rev 4849) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-15 19:17:15 UTC (rev 4850) @@ -57,13 +57,13 @@ private static FileFilter scriptFileFilter; @NotNull - private static GlobalSettings globalSettings; + protected static GlobalSettings globalSettings; /** * The map manager instance to use. */ @NotNull - private static MapManager<?, ?, ?, ?> mapManager; + protected static MapManager<?, ?, ?, ?> mapManager; protected static JComboBox pluginNameBox; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:19:02
|
Revision: 4851 http://gridarta.svn.sourceforge.net/gridarta/?rev=4851&view=rev Author: akirschbaum Date: 2008-08-15 19:19:09 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:17:15 UTC (rev 4850) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:19:09 UTC (rev 4851) @@ -216,7 +216,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); - ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:17:15 UTC (rev 4850) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:19:09 UTC (rev 4851) @@ -272,7 +272,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); - ScriptedEventEditor.setGlobalSettings(globalSettings); final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 19:17:15 UTC (rev 4850) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 19:19:09 UTC (rev 4851) @@ -29,6 +29,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.map.MapPreviewAccessory; @@ -114,6 +115,7 @@ copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); + ScriptedEventEditor.setGlobalSettings(globalSettings); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:35:20
|
Revision: 4852 http://gridarta.svn.sourceforge.net/gridarta/?rev=4852&view=rev Author: akirschbaum Date: 2008-08-15 19:35:28 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove unused import statements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:19:09 UTC (rev 4851) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:35:28 UTC (rev 4852) @@ -64,7 +64,6 @@ import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; -import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:19:09 UTC (rev 4851) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:35:28 UTC (rev 4852) @@ -25,7 +25,6 @@ import daieditor.gameobject.GameObject; import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.face.FaceObjects; -import daieditor.gameobject.scripts.ScriptArchEditor; import daieditor.gameobject.scripts.ScriptArchUtils; import daieditor.gameobject.scripts.ScriptedEvent; import daieditor.gui.GameObjectAttributesControl; @@ -73,7 +72,6 @@ import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; -import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 19:35:51
|
Revision: 4853 http://gridarta.svn.sourceforge.net/gridarta/?rev=4853&view=rev Author: akirschbaum Date: 2008-08-15 19:35:58 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:35:28 UTC (rev 4852) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:35:58 UTC (rev 4853) @@ -65,9 +65,10 @@ boolean inAnim = false; String animName = null; final StringBuilder animText = new StringBuilder(); - String thisLine2; - while ((thisLine2 = in.readLine()) != null) { - final String line = thisLine2.trim(); + String line2; + int lineNumber; + for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { + final String line = line2.trim(); if (line.startsWith("#")) { /* ignore comment lines. */ Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:35:28 UTC (rev 4852) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:35:58 UTC (rev 4853) @@ -92,9 +92,10 @@ boolean inAnim = false; String animName = null; final StringBuilder animText = new StringBuilder(); - String line; + String line2; int lineNumber; - for (lineNumber = 1; (line = in.readLine()) != null; lineNumber++) { + for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { + final String line = line2.trim(); if (line.startsWith("#")) { /* ignore comment lines. */ } else if (line.startsWith("anim ")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:02:01
|
Revision: 4856 http://gridarta.svn.sourceforge.net/gridarta/?rev=4856&view=rev Author: akirschbaum Date: 2008-08-15 20:02:05 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:46:53 UTC (rev 4855) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) @@ -25,9 +25,7 @@ import java.io.IOException; import java.io.Reader; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; @@ -52,38 +50,11 @@ @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"}) private final List<AnimationObject> animObjects = new ArrayList<AnimationObject>(); - /** - * This Map holds (anim object name, path to arc file) pairs. The object - * name is included in the path. - */ - private final Map<String, String> animMap = new HashMap<String, String>(); - /** {@inheritDoc} */ public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { addAnimationObject(animName, list, null); } - /** - * Adds a new animation object. If <code>path == null</code> path will be - * read from {@link #animMap}. - * @param animName name of the animation object to add - * @param list String with animation list data - * @param path Path relative to the arch directory - * @throws DuplicateAnimationException in case the animation was not unique - */ - public void addAnimationObject(final String animName, final String list, @Nullable final String path) throws DuplicateAnimationException { - final AnimationObject animationObject; - if (path == null) { - animationObject = new AnimationObject(animName, list, animMap.get(animName)); - } else { - animationObject = new AnimationObject(animName, list, path + '/' + animName); - } - if (containsKey(animName)) { - throw new DuplicateAnimationException(animationObject); - } - put(animationObject); - } - /** {@inheritDoc} */ @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { @@ -127,13 +98,15 @@ } /** {@inheritDoc} */ - public void addAnimPath(final String name, final String path) { - animMap.put(name, path); + public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + // TODO } /** {@inheritDoc} */ - public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { - // TODO + @NotNull + @Override + protected AnimationObject newAnimationObject(@NotNull final String animName, @NotNull final String animList, @NotNull final String path) { + return new AnimationObject(animName, animList, path); } } // class AnimationObjects Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 19:46:53 UTC (rev 4855) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) @@ -30,8 +30,6 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; -import java.util.HashMap; -import java.util.Map; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; @@ -53,38 +51,11 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** - * This Map holds (anim object name, path to arc file) pairs. The object - * name is included in the path. - */ - private final Map<String, String> animMap = new HashMap<String, String>(); - /** {@inheritDoc} */ public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { addAnimationObject(animName, list, null); } - /** - * Adds a new animation object. If <code>path == null</code> path will be - * read from {@link #animMap}. - * @param animName name of the animation object to add - * @param list String with animation list data - * @param path Path relative to the arch directory - * @throws DuplicateAnimationException in case the animation was not unique - */ - public void addAnimationObject(final String animName, final String list, @Nullable final String path) throws DuplicateAnimationException { - final AnimationObject animationObject; - if (path == null) { - animationObject = new AnimationObject(animName, list, animMap.get(animName)); - } else { - animationObject = new AnimationObject(animName, list, path + '/' + animName); - } - if (containsKey(animName)) { - throw new DuplicateAnimationException(animationObject); - } - put(animationObject); - } - /** {@inheritDoc} */ @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { @@ -133,20 +104,7 @@ } } - /** {@inheritDoc} */ - public void addAnimPath(final String name, final String path) { - animMap.put(name, path); - } - /** - * Returns Animation Path Tree. - * @return <var>animHashTable</var> - */ - public Map<String, String> getAnimPathTree() { - return animMap; - } - - /** * Reads Animation Tree from Stream. * @param reader Input stream * @throws IOException in case of I/O errors @@ -219,4 +177,11 @@ } } + /** {@inheritDoc} */ + @NotNull + @Override + protected AnimationObject newAnimationObject(@NotNull final String animName, @NotNull final String animList, @NotNull final String path) { + return new AnimationObject(animName, animList, path); + } + } // class AnimationObjects Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 19:46:53 UTC (rev 4855) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) @@ -25,10 +25,14 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.util.HashMap; +import java.util.Map; import net.sf.gridarta.data.AbstractNamedObjects; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Abstract base implementation of {@link AnimationObjects}. @@ -39,6 +43,12 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + /** + * This Map holds (anim object name, path to arc file) pairs. The object + * name is included in the path. + */ + private final Map<String, String> animMap = new HashMap<String, String>(); + /** Create an AnimationObjects instance. */ protected AbstractAnimationObjects() { super(ACTION_FACTORY.getString("nameOfAnimationObject")); @@ -55,4 +65,48 @@ } } + /** + * Adds a new animation object. If <code>path == null</code> path will be + * read from {@link #animMap}. + * @param animName name of the animation object to add + * @param list String with animation list data + * @param path Path relative to the arch directory + * @throws DuplicateAnimationException in case the animation was not unique + */ + public void addAnimationObject(final String animName, final String list, @Nullable final String path) throws DuplicateAnimationException { + final E animationObject; + if (path == null) { + animationObject = newAnimationObject(animName, list, animMap.get(animName)); + } else { + animationObject = newAnimationObject(animName, list, path + '/' + animName); + } + if (containsKey(animName)) { + throw new DuplicateAnimationException(animationObject); + } + put(animationObject); + } + + /** + * Creates a new {@link AnimationObject} instance. + * @param animName the animation name + * @param animList the list of animations + * @param path the path name + * @return the anmation object instance + */ + @NotNull + protected abstract E newAnimationObject(@NotNull final String animName, @NotNull final String animList, @NotNull final String path); + + /** {@inheritDoc} */ + public void addAnimPath(final String name, final String path) { + animMap.put(name, path); + } + + /** + * Returns Animation Path Tree. + * @return <var>animHashTable</var> + */ + public Map<String, String> getAnimPathTree() { + return animMap; + } + } // class AbstractAnimationObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:04:31
|
Revision: 4857 http://gridarta.svn.sourceforge.net/gridarta/?rev=4857&view=rev Author: akirschbaum Date: 2008-08-15 20:04:36 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -56,44 +56,6 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - boolean inAnim = false; - String animName = null; - final StringBuilder animText = new StringBuilder(); - String line2; - int lineNumber; - for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { - final String line = line2.trim(); - if (line.startsWith("#")) { - /* ignore comment lines. */ - } else if (line.startsWith("anim ")) { - if (inAnim) { - throw new AnimationParseException("mina", line, lineNumber); - } - inAnim = true; - animName = line.substring("anim ".length()); - animText.setLength(0); - } else if ("mina".equals(line)) { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - inAnim = false; - addAnimationObject(animName, animText.toString(), path); - } else { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - animText.append(line).append('\n'); - } - } - if (inAnim) { - throw new AnimationParseException("mina", null, lineNumber); - } - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { } Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -57,44 +57,6 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - boolean inAnim = false; - String animName = null; - final StringBuilder animText = new StringBuilder(); - String line2; - int lineNumber; - for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { - final String line = line2.trim(); - if (line.startsWith("#")) { - /* ignore comment lines. */ - } else if (line.startsWith("anim ")) { - if (inAnim) { - throw new AnimationParseException("mina", line, lineNumber); - } - inAnim = true; - animName = line.substring("anim ".length()); - animText.setLength(0); - } else if ("mina".equals(line)) { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - inAnim = false; - addAnimationObject(animName, animText.toString(), path); - } else { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } - animText.append(line).append('\n'); - } - } - if (inAnim) { - throw new AnimationParseException("mina", null, lineNumber); - } - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(animTreeFile), IOUtils.MAP_ENCODING)); try { Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:02:05 UTC (rev 4856) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) @@ -19,6 +19,7 @@ package net.sf.gridarta.gameobject.anim; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -109,4 +110,42 @@ return animMap; } + /** {@inheritDoc} */ + @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) + public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { + final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); + boolean inAnim = false; + String animName = null; + final StringBuilder animText = new StringBuilder(); + String line2; + int lineNumber; + for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { + final String line = line2.trim(); + if (line.startsWith("#")) { + /* ignore comment lines. */ + } else if (line.startsWith("anim ")) { + if (inAnim) { + throw new AnimationParseException("mina", line, lineNumber); + } + inAnim = true; + animName = line.substring("anim ".length()); + animText.setLength(0); + } else if ("mina".equals(line)) { + if (!inAnim) { + throw new AnimationParseException("anim ...", line, lineNumber); + } + inAnim = false; + addAnimationObject(animName, animText.toString(), path); + } else { + if (!inAnim) { + throw new AnimationParseException("anim ...", line, lineNumber); + } + animText.append(line).append('\n'); + } + } + if (inAnim) { + throw new AnimationParseException("mina", null, lineNumber); + } + } + } // class AbstractAnimationObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:05:40
|
Revision: 4858 http://gridarta.svn.sourceforge.net/gridarta/?rev=4858&view=rev Author: akirschbaum Date: 2008-08-15 20:05:46 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove unused import statements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:05:46 UTC (rev 4858) @@ -19,20 +19,16 @@ package cfeditor.gameobject.anim; -import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.Reader; import java.util.ArrayList; import java.util.List; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; -import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.japi.swing.misc.Progress; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * The <code>AnimationObject</code>. AnimationObjects are iterated in Unicode Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:04:36 UTC (rev 4857) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:05:46 UTC (rev 4858) @@ -29,15 +29,12 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.Reader; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; -import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.io.IOUtils; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * The <code>AnimationObject</code>. AnimationObjects are iterated in Unicode This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:07:51
|
Revision: 4859 http://gridarta.svn.sourceforge.net/gridarta/?rev=4859&view=rev Author: akirschbaum Date: 2008-08-15 20:07:57 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:05:46 UTC (rev 4858) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:07:57 UTC (rev 4859) @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.List; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; -import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.japi.swing.misc.Progress; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -47,11 +46,6 @@ private final List<AnimationObject> animObjects = new ArrayList<AnimationObject>(); /** {@inheritDoc} */ - public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { - addAnimationObject(animName, list, null); - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { } Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:05:46 UTC (rev 4858) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2008-08-15 20:07:57 UTC (rev 4859) @@ -30,7 +30,6 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; -import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.io.IOUtils; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.Progress; @@ -49,11 +48,6 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); /** {@inheritDoc} */ - public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { - addAnimationObject(animName, list, null); - } - - /** {@inheritDoc} */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(animTreeFile), IOUtils.MAP_ENCODING)); try { Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:05:46 UTC (rev 4858) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:07:57 UTC (rev 4859) @@ -66,6 +66,11 @@ } } + /** {@inheritDoc} */ + public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { + addAnimationObject(animName, list, null); + } + /** * Adds a new animation object. If <code>path == null</code> path will be * read from {@link #animMap}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:24:11
|
Revision: 4861 http://gridarta.svn.sourceforge.net/gridarta/?rev=4861&view=rev Author: akirschbaum Date: 2008-08-15 20:24:16 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Fix animations parser in CrossfireEditor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-15 20:10:25 UTC (rev 4860) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-15 20:24:16 UTC (rev 4861) @@ -244,7 +244,7 @@ try { final Reader in = new BufferedReader(new FileReader(filename)); try { - animationObjects.loadAnims(in, filename); + animationObjects.loadAnims(in, "animation ", true, filename); } finally { in.close(); } Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-15 20:10:25 UTC (rev 4860) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-15 20:24:16 UTC (rev 4861) @@ -417,7 +417,7 @@ private void loadAnimsFromFiles() { for (final File animFile : animFiles) { try { - animationObjects.loadAnims(animFile); + animationObjects.loadAnims(animFile, "anim ", false); } catch (final DuplicateAnimationException e) { mainControl.handleThrowable(e); } catch (final IOException e) { @@ -436,7 +436,7 @@ try { final Reader in = IOUtils.createReader(baseDir, "animations"); try { - animationObjects.loadAnims(in, null); + animationObjects.loadAnims(in, "anim ", false, null); } finally { in.close(); } Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:10:25 UTC (rev 4860) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObjects.java 2008-08-15 20:24:16 UTC (rev 4861) @@ -56,11 +56,11 @@ } /** {@inheritDoc} */ - public void loadAnims(final File animFile) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException { + public void loadAnims(final File animFile, @NotNull final String startKey, final boolean ignoreOtherText) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException { final Reader in = new InputStreamReader(new FileInputStream(animFile), IOUtils.MAP_ENCODING); try { final String path = (new File(PathManager.getArchPath(animFile.getPath()))).getParent().replace('\\', '/'); - loadAnims(in, path); + loadAnims(in, startKey, ignoreOtherText, path); } finally { in.close(); } @@ -117,7 +117,7 @@ /** {@inheritDoc} */ @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { + public void loadAnims(final Reader reader, @NotNull final String startKey, final boolean ignoreOtherText, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); boolean inAnim = false; String animName = null; @@ -128,24 +128,23 @@ final String line = line2.trim(); if (line.startsWith("#")) { /* ignore comment lines. */ - } else if (line.startsWith("anim ")) { + } else if (line.startsWith(startKey)) { if (inAnim) { throw new AnimationParseException("mina", line, lineNumber); } inAnim = true; - animName = line.substring("anim ".length()); + animName = line.substring(startKey.length()); animText.setLength(0); } else if ("mina".equals(line)) { if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); + throw new AnimationParseException(startKey + "...", line, lineNumber); } inAnim = false; addAnimationObject(animName, animText.toString(), path); - } else { - if (!inAnim) { - throw new AnimationParseException("anim ...", line, lineNumber); - } + } else if (inAnim) { animText.append(line).append('\n'); + } else if (!ignoreOtherText) { + throw new AnimationParseException(startKey + "...", line, lineNumber); } } if (inAnim) { Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObjects.java 2008-08-15 20:10:25 UTC (rev 4860) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObjects.java 2008-08-15 20:24:16 UTC (rev 4861) @@ -25,6 +25,7 @@ import java.io.Reader; import net.sf.gridarta.data.NamedObjects; import net.sf.gridarta.gameobject.Collectable; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -51,13 +52,17 @@ /** * Loads animations from a file. * @param animFile file to load animations from + * @param startKey the key that begins an animation block; it must end with + * a space character + * @param ignoreOtherText if set, ignore all text outside animation + * definitions * @throws IOException in case of I/O errors * @throws FileNotFoundException in case the file couldn't be opened * @throws AnimationParseException in case parsing the animation reveals * errors * @throws DuplicateAnimationException in case an animation was not unique */ - void loadAnims(File animFile) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException; + void loadAnims(File animFile, @NotNull String startKey, boolean ignoreOtherText) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException; /** * Loads any number of animations from a reader. It is not neccessary to @@ -65,6 +70,10 @@ * supplied <var>reader</var> with a BufferedReader if the supplied reader * isn't already a BufferedReader itself. * @param reader Reader to load animations from + * @param startKey the key that begins an animation block; it must end with + * a space character + * @param ignoreOtherText if set, ignore all text outside animation + * definitions * @param path Path relative to the arch directory, used to create tree * information * @throws IOException in case of I/O errors @@ -72,7 +81,7 @@ * errors * @throws DuplicateAnimationException in case an animation was not unique */ - void loadAnims(Reader reader, @Nullable String path) throws IOException, AnimationParseException, DuplicateAnimationException; + void loadAnims(Reader reader, @NotNull String startKey, boolean ignoreOtherText, @Nullable String path) throws IOException, AnimationParseException, DuplicateAnimationException; /** * Loads animations from a file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:45:02
|
Revision: 4863 http://gridarta.svn.sourceforge.net/gridarta/?rev=4863&view=rev Author: akirschbaum Date: 2008-08-15 20:45:08 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Improve error messages. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 20:38:31 UTC (rev 4862) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 20:45:08 UTC (rev 4863) @@ -173,7 +173,7 @@ animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user - log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e)); + log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } archetype.addObjectText("animation " + archetype.getArchetypeName()); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 20:38:31 UTC (rev 4862) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 20:45:08 UTC (rev 4863) @@ -170,7 +170,7 @@ animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user - log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e)); + log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } archetype.addObjectText("animation " + archetype.getArchetypeName()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 20:59:11
|
Revision: 4864 http://gridarta.svn.sourceforge.net/gridarta/?rev=4864&view=rev Author: akirschbaum Date: 2008-08-15 20:59:19 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Prepend an underscore to auto-generated animation names to avoid clashes with manually defined animations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 20:45:08 UTC (rev 4863) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 20:59:19 UTC (rev 4864) @@ -166,18 +166,19 @@ } } else if (animflag) { if (thisLine.equals("mina")) { + final String animationName = "_" + archetype.getArchetypeName(); try { archetype.setAnimText(animText.toString()); - animationObjects.addAnimPath(archetype.getArchetypeName(), path + archetype.getArchetypeName()); - animationObjects.addAnimationObject(archetype.getArchetypeName(), animText.toString()); + animationObjects.addAnimPath(animationName, path + archetype.getArchetypeName()); + animationObjects.addAnimationObject(animationName, animText.toString()); animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } - archetype.addObjectText("animation " + archetype.getArchetypeName()); - archetype.setAnimName(archetype.getArchetypeName()); + archetype.addObjectText("animation " + animationName); + archetype.setAnimName(animationName); // here we must add this to AnimationObject // and add Animation cmd here! Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 20:45:08 UTC (rev 4863) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 20:59:19 UTC (rev 4864) @@ -164,17 +164,18 @@ } } else if (animflag) { if (thisLine.equals("mina")) { + final String animationName = "_" + archetype.getArchetypeName(); try { - animationObjects.addAnimPath(archetype.getArchetypeName(), path + archetype.getArchetypeName()); - animationObjects.addAnimationObject(archetype.getArchetypeName(), animText.toString()); + animationObjects.addAnimPath(animationName, path + archetype.getArchetypeName()); + animationObjects.addAnimationObject(animationName, animText.toString()); animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } - archetype.addObjectText("animation " + archetype.getArchetypeName()); - archetype.setAnimName(archetype.getArchetypeName()); + archetype.addObjectText("animation " + animationName); + archetype.setAnimName(animationName); // here we must add this to AnimationObject // and add Animation cmd here! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 21:09:29
|
Revision: 4866 http://gridarta.svn.sourceforge.net/gridarta/?rev=4866&view=rev Author: akirschbaum Date: 2008-08-15 21:09:37 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove dependency MapUserListener -> CMapViewBasic. 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 Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-08-15 21:06:04 UTC (rev 4865) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-08-15 21:09:37 UTC (rev 4866) @@ -134,7 +134,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(renderer, 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-08-15 21:06:04 UTC (rev 4865) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-08-15 21:09:37 UTC (rev 4866) @@ -138,7 +138,7 @@ mapModel.addMapModelListener(mapModelListener); - mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, toolPalette); + mapUserListener = new MapUserListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(renderer, 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-08-15 21:06:04 UTC (rev 4865) +++ trunk/src/app/net/sf/gridarta/gui/map/MapUserListener.java 2008-08-15 21:09:37 UTC (rev 4866) @@ -48,9 +48,9 @@ /*XXX:@NotNull*/ private MouseOpEvent<G, A, R, V> mouseOpEvent = null; - public MapUserListener(final V mapViewBasic, @NotNull final ToolPalette<G, A, R, V> toolPalette) { + public MapUserListener(final LevelRenderer renderer, @NotNull final ToolPalette<G, A, R, V> toolPalette) { this.toolPalette = toolPalette; - renderer = mapViewBasic.getRenderer(); + this.renderer = renderer; } public void init(@NotNull final MapView<G, A, R, V> mapView) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |