From: <aki...@us...> - 2008-07-27 22:53:40
|
Revision: 4520 http://gridarta.svn.sourceforge.net/gridarta/?rev=4520&view=rev Author: akirschbaum Date: 2008-07-27 22:53:48 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:35:50 UTC (rev 4519) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:53:48 UTC (rev 4520) @@ -235,7 +235,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:35:50 UTC (rev 4519) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:53:48 UTC (rev 4520) @@ -293,7 +293,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 22:35:50 UTC (rev 4519) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 22:53:48 UTC (rev 4520) @@ -26,6 +26,7 @@ import javax.swing.Action; import javax.swing.JOptionPane; import net.sf.gridarta.CopyBuffer; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; @@ -67,6 +68,10 @@ /** The MainControl. */ private final MainControl<G, A, R, V> mainControl; + /** The edit types instance. */ + @NotNull + private final EditTypes<G, A, R, V> editTypes; + /** The archetype set instance. */ private final ArchetypeSet<G, A, R> archetypeSet; @@ -290,6 +295,7 @@ /** * Create a new instance. * @param mainControl the MainControl + * @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 @@ -299,8 +305,9 @@ * @param objectChooser the animation objects instance to use * @param mapManager the map manager instance */ - public MainActions(@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 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) { + public MainActions(@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) { this.mainControl = mainControl; + this.editTypes = editTypes; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; this.pickmapChooserControl = pickmapChooserControl; @@ -699,7 +706,7 @@ return null; } - final ShiftProcessor<G, A, R> shiftProcessor = new ShiftProcessor<G, A, R>(mainControl, mapView, mapControl.getMapModel()); + final ShiftProcessor<G, A, R> shiftProcessor = new ShiftProcessor<G, A, R>(editTypes, mapView, mapControl.getMapModel()); return shiftProcessor.canShift(dir) ? shiftProcessor : null; } Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-27 22:35:50 UTC (rev 4519) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-27 22:53:48 UTC (rev 4520) @@ -23,7 +23,7 @@ import java.awt.Rectangle; import java.util.LinkedList; import java.util.List; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -45,7 +45,7 @@ /** The main control. */ @NotNull - private final MainControl<G, A, R, ?> mainControl; + private final EditTypes<G, A, R, ?> editTypes; /** The map view to operate on. */ @NotNull @@ -71,12 +71,12 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param editTypes the edit types instance * @param mapView The map view to operate on. * @param mapModel The map model to operate on. */ - public ShiftProcessor(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final MapView<G, A, R, ?> mapView, @NotNull final MapModel<G, A, R> mapModel) { - this.mainControl = mainControl; + public ShiftProcessor(@NotNull final EditTypes<G, A, R, ?> editTypes, @NotNull final MapView<G, A, R, ?> mapView, @NotNull final MapModel<G, A, R> mapModel) { + this.editTypes = editTypes; this.mapView = mapView; this.mapModel = mapModel; } @@ -257,7 +257,7 @@ // [startGameObjects] = [prevPos] assert startGameObjects.isEmpty(); for (final G gameObject : mapModel.getMapSquare(prevPos)) { - if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject)) { + if (gameObject.isHead() && !gameObject.isInContainer() && editTypes.isEditType(gameObject)) { startGameObjects.add(gameObject); gameObjectsToDelete.add(gameObject); } @@ -265,7 +265,7 @@ } // [prevPos] = [pos] for (final G gameObject : mapModel.getMapSquare(pos)) { - if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject)) { + if (gameObject.isHead() && !gameObject.isInContainer() && editTypes.isEditType(gameObject)) { mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); gameObjectsToDelete.add(gameObject); } @@ -275,7 +275,7 @@ isStart = true; // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { - assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject); + assert gameObject.isHead() && !gameObject.isInContainer() && editTypes.isEditType(gameObject); mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); @@ -295,7 +295,7 @@ if (!isStart) { // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { - assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject); + assert gameObject.isHead() && !gameObject.isInContainer() && editTypes.isEditType(gameObject); mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 23:00:23
|
Revision: 4522 http://gridarta.svn.sourceforge.net/gridarta/?rev=4522&view=rev Author: akirschbaum Date: 2008-07-27 23:00:31 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:00:05 UTC (rev 4521) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:00:31 UTC (rev 4522) @@ -237,7 +237,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:00:05 UTC (rev 4521) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:00:31 UTC (rev 4522) @@ -295,7 +295,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-27 23:00:05 UTC (rev 4521) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-27 23:00:31 UTC (rev 4522) @@ -43,6 +43,7 @@ import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -233,13 +234,14 @@ /** * Constructs the main view and registers the given main controller. * @param mainControl MainControl to attach to. + * @param editTypes the edit types instance * @param objectChooser the object chooser * @param mapManager the map manager * @param actionFactory the action factory to use * @param aCloseAll the action "close all map windows" * @param faceObjects the FaceObjects instance to use */ - public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final FaceObjects faceObjects) { + public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final FaceObjects faceObjects) { super(actionFactory.format("mainWindow.title", AbstractMainControl.getBuildNumberAsString())); this.mapManager = mapManager; mapFileAction = new MapFileActions<G, A, R, V>(mainControl, mapManager, null); @@ -260,7 +262,7 @@ aNextWindow = actionFactory.createAction(true, "nextWindow", this); actionFactory.createAction(true, "viewTreasurelists", mainControl); - viewActions = new ViewActions<G, A, R, V>(mainControl, mapManager); + viewActions = new ViewActions<G, A, R, V>(mainControl, editTypes, mapManager); final ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); if (icon != null) { Modified: trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-07-27 23:00:05 UTC (rev 4521) +++ trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-07-27 23:00:31 UTC (rev 4522) @@ -28,6 +28,7 @@ import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; import net.sf.gridarta.CurrentMapListener; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; @@ -48,9 +49,9 @@ /** Action Factory to create Actions. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** The main control to use. */ + /** The edit types instance. */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final EditTypes<G, A, R, V> editTypes; /** The listener to check for current map changes. */ private final CurrentMapListener<G, A, R, V> currentMapListener; @@ -61,10 +62,11 @@ /** * Create a new instance. * @param mainControl the main control to use + * @param editTypes the edit types instance * @param mapManager the map manager */ - public ViewActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager) { - this.mainControl = mainControl; + public ViewActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final MapManager<G, A, R, V> mapManager) { + this.editTypes = editTypes; ACTION_FACTORY.createActions(true, this, "resetView"); currentMapListener = new CurrentMapListener<G, A, R, V>(mainControl, mapManager, null, false, false, false) { @@ -113,7 +115,7 @@ */ public void init(@NotNull final GameObjectMatchers gameObjectMatchers) { for (final NamedGameObjectMatcher matcher : gameObjectMatchers.getFilters()) { - viewActions.add(new ViewAction(mainControl, matcher)); + viewActions.add(new ViewAction(editTypes, matcher)); } } @@ -145,7 +147,7 @@ /** Action method for "reset view". */ public void resetView() { // set edit type to zero (-> show all) - mainControl.getEditTypes().unsetEditType(~0); + editTypes.unsetEditType(~0); updateActions(); } @@ -165,9 +167,9 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** The main control to use. */ + /** The edit types instance. */ @NotNull - private final transient MainControl<?, ?, ?, ?> mainControl; + private final EditTypes<?, ?, ?, ?> editTypes; /** The name for sorting the menu entries. */ private final String name; @@ -180,12 +182,12 @@ /** * Creates a new instance. - * @param mainControl the main control + * @param editTypes the edit types instance * @param matcher the matcher */ - public ViewAction(@NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final NamedGameObjectMatcher matcher) { + public ViewAction(@NotNull final EditTypes<?, ?, ?, ?> editTypes, @NotNull final NamedGameObjectMatcher matcher) { super(ACTION_FACTORY.format("show.text", matcher.getName())); - this.mainControl = mainControl; + this.editTypes = editTypes; name = matcher.getName(); editType = matcher.getEditType(); } @@ -200,7 +202,7 @@ /** Update the action's state to match the current edit type settings. */ public void updateAction() { - checkBoxMenuItem.setSelected(mainControl.getEditTypes().isEditType(editType)); + checkBoxMenuItem.setSelected(editTypes.isEditType(editType)); } /** {@inheritDoc} */ @@ -209,10 +211,10 @@ return; } - if (mainControl.getEditTypes().isEditType(editType)) { - mainControl.getEditTypes().unsetEditType(editType); + if (editTypes.isEditType(editType)) { + editTypes.unsetEditType(editType); } else { - mainControl.getEditTypes().setEditType(editType); + editTypes.setEditType(editType); } updateAction(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 23:06:04
|
Revision: 4523 http://gridarta.svn.sourceforge.net/gridarta/?rev=4523&view=rev Author: akirschbaum Date: 2008-07-27 23:06:09 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -234,7 +234,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -292,7 +292,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -28,6 +28,7 @@ import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import net.sf.gridarta.CopyBuffer; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -92,11 +93,12 @@ /** * Creates a new instance. + * @param editTypes the edit types instance * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; @@ -111,7 +113,7 @@ // ignore } }); - toolPalette = new ToolPalette<G, A, R, V>(mainControl, selectedSquareView, this, pickmapChooserControl, copyBuffer); + toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, this); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -27,7 +27,7 @@ import java.util.Set; import javax.swing.JComboBox; import javax.swing.JPanel; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -103,7 +103,7 @@ /** The main control. */ @NotNull - private final MainControl<G, ?, ?, ?> mainControl; + private final EditTypes<G, A, R, V> editTypes; /** * A {@link GameObjectMatcher} matching floor game objects. @@ -175,13 +175,13 @@ /** * Create a DeletionTool. - * @param mainControl the main control + * @param editTypes the edit types instance * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use */ - public DeletionTool(@NotNull final MainControl<G, ?, ?, ?> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public DeletionTool(@NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super("deletion"); - this.mainControl = mainControl; + this.editTypes = editTypes; this.objectChooser = objectChooser; this.pickmapChooserControl = pickmapChooserControl; } @@ -286,7 +286,7 @@ } if (foundFirst) { final G head = gameObject.getHead(); - if (mainControl.getEditTypes().isEditType(head)) { + if (editTypes.isEditType(head)) { boolean insert = false; switch (scopeType) { case SCOPE_TILE: Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -26,6 +26,7 @@ import javax.swing.JPanel; import javax.swing.JTabbedPane; import net.sf.gridarta.CopyBuffer; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -68,16 +69,17 @@ * Create a ToolPalette. * @param mainControl MainControl to use (required for {@link * net.sf.gridarta.gui.map.tools.InsertionTool}). + * @param editTypes the edit types instance * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use * @param copyBuffer the copy buffer instance to use */ - public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @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) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); add(new JLabel(ACTION_FACTORY.getString("mouse")), BorderLayout.NORTH); mouseTabs.add(ACTION_FACTORY.getString("left"), lmbSelector); mouseTabs.add(ACTION_FACTORY.getString("middle"), mmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-27 23:00:31 UTC (rev 4522) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-07-27 23:06:09 UTC (rev 4523) @@ -33,6 +33,7 @@ import javax.swing.JPanel; import javax.swing.JToggleButton; import net.sf.gridarta.CopyBuffer; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -90,14 +91,15 @@ * @param defaultTool name of the tool that should be selected by default * @param mainControl MainControl to use (required for {@link * InsertionTool}). + * @param editTypes the edit types instance * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use * @param copyBuffer the copy buffer instance to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @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) { 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>(mainControl, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { + for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser, copyBuffer), new DeletionTool<G, A, R, V>(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-07-27 23:10:42
|
Revision: 4525 http://gridarta.svn.sourceforge.net/gridarta/?rev=4525&view=rev Author: akirschbaum Date: 2008-07-27 23:10:50 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:06:59 UTC (rev 4524) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:10:50 UTC (rev 4525) @@ -224,7 +224,7 @@ archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects, globalSettings.getImageSet()); scriptControl = new ScriptController(this); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, null, archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:06:59 UTC (rev 4524) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:10:50 UTC (rev 4525) @@ -280,7 +280,7 @@ animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-27 23:06:59 UTC (rev 4524) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-07-27 23:10:50 UTC (rev 4525) @@ -26,6 +26,7 @@ import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.event.EventListenerList; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -82,16 +83,17 @@ * Create a SelectedSquareControl. * @param actionFactory the action factory * @param mainControl MainControl, used for icons + * @param editTypes the edit types instance * @param mapTileListBottom set if the map tile list should be at the bottom * or on the top of the main view * @param compassIcon If non-<code>null</code>, display this icon on the top * of the list * @param archetypeSet the archetype set to use */ - public SelectedSquareControl(@NotNull final ActionFactory actionFactory, final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + public SelectedSquareControl(@NotNull final ActionFactory actionFactory, final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { this.mainControl = mainControl; - view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mainControl, mapTileListBottom, compassIcon, archetypeSet); + view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mainControl, editTypes, mapTileListBottom, compassIcon, archetypeSet); } MouseListener getMouseListener() { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-27 23:06:59 UTC (rev 4524) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-27 23:10:50 UTC (rev 4525) @@ -38,6 +38,7 @@ import javax.swing.ScrollPaneConstants; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; @@ -74,9 +75,9 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(SelectedSquareView.class); - /** The main control for this view. */ + /** The edit types instance. */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final EditTypes<G, A, R, V> editTypes; /** The controller for this view. */ @NotNull @@ -214,14 +215,15 @@ * @param actionFactory the action factory * @param control the controller for this view * @param mainControl the main controller for this view + * @param editTypes the edit types instance * @param mapTileListBottom set if the map tile list should be at the bottom * or on the top of the main view * @param compassIcon if non-<code>null</code>, display this icon on the top * of the list * @param archetypeSet the archetype set to use */ - SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @NotNull final MainControl<G, A, R, V> mainControl, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { - this.mainControl = mainControl; + SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + this.editTypes = editTypes; this.control = control; mapTileSelectionCache = new MapTileSelectionCache<G, A, R, V>(mainControl.getMapManager()); @@ -360,7 +362,7 @@ model.addElement(node); // if view-settings are applied, mark topmost "visible" tile for selection - if (mainControl.getEditTypes().isEditTypeSet() && !foundSIndex && mainControl.getEditTypes().isEditType(node.getEditType())) { + if (editTypes.isEditTypeSet() && !foundSIndex && editTypes.isEditType(node.getEditType())) { sIndex = listCounter - 1; // select this tile foundSIndex = true; // this is it - don't select any other tile } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 23:18:20
|
Revision: 4526 http://gridarta.svn.sourceforge.net/gridarta/?rev=4526&view=rev Author: akirschbaum Date: 2008-07-27 23:18:26 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java trunk/src/app/net/sf/gridarta/io/GameObjectParser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -221,7 +221,7 @@ super(new CrossfireObjectsFactory(), "cfeditor"); globalSettings.readGlobalSettings(); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects, globalSettings.getImageSet()); + archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects, globalSettings.getImageSet()); scriptControl = new ScriptController(this); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, null, archetypeSet); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -104,7 +104,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, editTypes, file); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -22,6 +22,7 @@ import cfeditor.CMainControl; import cfeditor.IGUIConstants; import cfeditor.gameobject.anim.AnimationObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -36,6 +37,7 @@ import java.util.Arrays; import java.util.List; import javax.swing.ImageIcon; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -68,6 +70,8 @@ private final CMainControl mainControl; + private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; + @NotNull private final AnimationObjects<AnimationObject> animationObjects; @@ -84,13 +88,15 @@ /** * Create the ArchetypeSet. * @param mainControl reference to CMainControl + * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use * @param imageSet the image set to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet) { + public ArchetypeSet(final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; + this.editTypes = editTypes; this.animationObjects = animationObjects; this.faceObjects = faceObjects; this.imageSet = imageSet; @@ -132,7 +138,7 @@ } reportErrors(mainControl.getMainView()); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, invObjects, fname, true); + mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -278,7 +278,7 @@ CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); + archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -107,7 +107,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, editTypes, file); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -22,6 +22,7 @@ import daieditor.CMainControl; import daieditor.IGUIConstants; import daieditor.gameobject.anim.AnimationObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -37,6 +38,7 @@ import java.util.Arrays; import java.util.List; import javax.swing.ImageIcon; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -70,7 +72,11 @@ private final CMainControl mainControl; + /** The edit types instance. */ @NotNull + private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; + + @NotNull private final AnimationObjects<AnimationObject> animationObjects; /** The FaceObjects instance to use. */ @@ -87,12 +93,14 @@ /** * Create the ArchetypeSet. * @param mainControl reference to CMainControl + * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + public ArchetypeSet(final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; + this.editTypes = editTypes; this.animationObjects = animationObjects; this.faceObjects = faceObjects; } @@ -168,7 +176,7 @@ loadArchesFromArtifacts(archetypeParser, mainControl.getCollectedDirectory() + "/" + IGUIConstants.ARTIFACTS_FILE, "Artifacts", "artifacts", invObjects); loadArchesFromArtifacts(archetypeParser, mainControl.getGlobalSettings().getMapDefaultFolder(), "Artifacts", "maps", invObjects); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, invObjects, fname, true); + mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -26,6 +26,7 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; @@ -169,7 +170,7 @@ } /** {@inheritDoc} */ - public void collectTempList(@NotNull final MainControl<G, A, R, ?> mainControl, final List<G> objects, final String uri, final boolean isInteractive) { + public void collectTempList(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final EditTypes<G, A, R, ?> editTypes, final List<G> objects, final String uri, final boolean isInteractive) { final List<G> tailList = new ArrayList<G>(); final Set<String> undefinedArchetypeNames = new TreeSet<String>(); @@ -187,7 +188,7 @@ // Ok, now is attached to default arch and loaded png // NOW we post parse the object... // (We calculate only edit types that are active, to save time) - gameObject.postParseGameObject(mainControl.getEditTypes().getEditType()); + gameObject.postParseGameObject(editTypes.getEditType()); gameObject.setObjectFace(); if (!gameObject.isInContainer()) { Modified: trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; @@ -50,6 +51,10 @@ @NotNull private final MainControl<G, A, R, ?> mainControl; + /** The edit types instance. */ + @NotNull + private final EditTypes<G, A, R, ?> editTypes; + /** ArchObjects that are read from the map. */ @NotNull private final List<G> objects = new ArrayList<G>(); @@ -81,11 +86,13 @@ /** * Open a file for reading it as a map. * @param mainControl The main control. + * @param editTypes the edit types instance * @param file File to open. * @throws FileNotFoundException in case the file was not found. */ - public DefaultMapReader(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final File file) throws FileNotFoundException { + public DefaultMapReader(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final EditTypes<G, A, R, ?> editTypes, @NotNull final File file) throws FileNotFoundException { this.mainControl = mainControl; + this.editTypes = editTypes; uri = file.toURI().toString(); try { myInput = new BufferedReader(new InputStreamReader(new FileInputStream(file), IOUtils.MAP_ENCODING)); @@ -129,7 +136,7 @@ while (gameObjectParser.load(myInput, objects) != null) { } - gameObjectParser.collectTempList(mainControl, objects, uri, isInteractive); + gameObjectParser.collectTempList(mainControl, editTypes, objects, uri, isInteractive); Collections.sort(objects, sorter); } Modified: trunk/src/app/net/sf/gridarta/io/GameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/GameObjectParser.java 2008-07-27 23:10:50 UTC (rev 4525) +++ trunk/src/app/net/sf/gridarta/io/GameObjectParser.java 2008-07-27 23:18:26 UTC (rev 4526) @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.Collection; import java.util.List; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -76,11 +77,12 @@ * Browse first through the default arch list and attach map arches to it * then browse through the face list and try to find the pictures. * @param mainControl The main control. + * @param editTypes the edit types instance * @param objects List of GameObjects to collect * @param uri URI they were read from (for error messages). * @param isInteractive if set, may ask to delete undefined archetypes; if * unset, keep undefined archetypes */ - void collectTempList(@NotNull MainControl<G, A, R, ?> mainControl, List<G> objects, String uri, boolean isInteractive); + void collectTempList(@NotNull MainControl<G, A, R, ?> mainControl, @NotNull EditTypes<G, A, R, ?> editTypes, List<G> objects, String uri, boolean isInteractive); } // interface GameObjectParser This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 23:49:20
|
Revision: 4530 http://gridarta.svn.sourceforge.net/gridarta/?rev=4530&view=rev Author: akirschbaum Date: 2008-07-27 23:49:27 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapImageCache(). 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/map/DefaultMapControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -236,16 +236,15 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); + SystemIcons.init(); + createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); updaterManager.startup(); - SystemIcons.init(); - createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - // initialize the script-editor pad ScriptEditControlInstance.init(this, new File(globalSettings.getMapDefaultFolder())); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -36,6 +36,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -85,6 +86,10 @@ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; + /** The {@link MapImageCache} instance to use. */ + @NotNull + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -126,13 +131,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @@ -148,12 +153,13 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; this.editTypes = editTypes; + this.mapImageCache = mapImageCache; } } // class CrossfireObjectsFactory Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -294,16 +294,15 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); + SystemIcons.init(); + createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); updaterManager.startup(); - SystemIcons.init(); - createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - // initialize & load MultiPositionData.init(getConfigurationDirectory()); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -36,6 +36,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -88,6 +89,10 @@ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; + /** The {@link MapImageCache} instance to use. */ + @NotNull + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -129,13 +134,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); mapArchObject.setDifficulty(1); return mapControl; } @@ -153,13 +158,14 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; this.editTypes = editTypes; + this.mapImageCache = mapImageCache; } } // class DaimoninObjectsFactory Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -139,7 +139,8 @@ * @param selectedSquareView the selected square view instance * @param mainControl the main control instance * @param editTypes the edit types instance + * @param mapImageCache the map image cache instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -73,6 +73,10 @@ @NotNull private final MainControl<G, A, R, V> mainControl; + /** The map image cache instance. */ + @NotNull + private final MapImageCache<G, A, R, V> mapImageCache; + /** Each view of this map will get a unique number. */ private int viewCounter = 0; @@ -144,15 +148,17 @@ * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory instance * @param mainControl the main control + * @param mapImageCache the map image cache instance * @param objects the game objects to insert; my be <code>null</code> * @param mapArchObject the map arch object for this map * @param isPickmap true if this is a pickmap * @param exitTypeGameObjectMatcher the matcher to select exit objects * @param archetypeChooserControl the archeype chooser control to use */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; + this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; // we create model (= data) mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl); @@ -402,7 +408,7 @@ mapFileEncoder.close(); } - mainControl.getMapImageCache().updateCaches(file, this, MapImageCache.Type.ICON); + mapImageCache.updateCaches(file, this, MapImageCache.Type.ICON); } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "encodeMapFile", file, e.getMessage()); return false; Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-27 23:34:46 UTC (rev 4529) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-27 23:49:27 UTC (rev 4530) @@ -30,10 +30,13 @@ import javax.swing.JList; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.DefaultMapManager; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.AbstractArchetypeParser; @@ -382,7 +385,9 @@ final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, archetypeSet, false); - final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, null, mapArchObject, false, null, archetypeChooserControl); + final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test"); + final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, mapManager, null, new ImageIcon(), new ImageIcon()); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl); mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl); result.setLength(0); @@ -532,14 +537,15 @@ * Creates a new instance * @param gridartaObjectsFactory the gridarta objects factory to use * @param mainControl the main control + * @param mapImageCache the map image cache instance * @param objects the objects to insert * @param mapArchObject the map arch object to use * @param isPickmap whether this map control is a pickmap * @param exitTypeGameObjectMatcher the exit matcher to use * @param archetypeChooserControl the archetype chooser control to use */ - public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl) { - super(gridartaObjectsFactory, mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl); + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl) { + super(gridartaObjectsFactory, mainControl, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl); } } @@ -928,7 +934,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { 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-07-28 07:56:52
|
Revision: 4531 http://gridarta.svn.sourceforge.net/gridarta/?rev=4531&view=rev Author: akirschbaum Date: 2008-07-28 07:56:59 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapImageCache(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 23:49:27 UTC (rev 4530) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 07:56:59 UTC (rev 4531) @@ -149,7 +149,7 @@ /** {@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, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 23:49:27 UTC (rev 4530) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 07:56:59 UTC (rev 4531) @@ -154,7 +154,7 @@ /** {@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, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-27 23:49:27 UTC (rev 4530) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-07-28 07:56:59 UTC (rev 4531) @@ -28,6 +28,7 @@ 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.MenuHelper; @@ -54,10 +55,6 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** The main control. */ - @NotNull - private final MainControl<G, A, R, V> mainControl; - /** The controller of this view. */ @NotNull private final MapControl<G, A, R, V> mapControl; @@ -69,6 +66,10 @@ @NotNull private final V mapViewBasic; + /** The map image cache instance. */ + @NotNull + private final MapImageCache<G, A, R, V> mapImageCache; + /** The map file actions for this map. */ @Nullable private final MapFileActions<G, A, R, V> mapFileActions; @@ -145,13 +146,14 @@ * @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) { + 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) { super(PathManager.getMapPath(mapControl.getMapFileName()) + " [ " + mapControl.getMapModel().getMapArchObject().getMapDisplayName() + " ] (" + number + ")" + (mapControl.isModified() ? " *" : ""), true, true, true, true); - this.mainControl = mainControl; this.mapControl = mapControl; this.number = number; this.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); mapControl.getMapModel().addMapModelListener(mapModelListener); @@ -224,7 +226,7 @@ /** Update the frame icon to the current icon image. */ protected void updateFrameIcon() { - final ImageIcon icon = mainControl.getMapImageCache().getOrCreateIcon(mapControl); + final ImageIcon icon = mapImageCache.getOrCreateIcon(mapControl); setFrameIcon(icon); windowAction.putValue(Action.SMALL_ICON, icon); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 08:11:04
|
Revision: 4533 http://gridarta.svn.sourceforge.net/gridarta/?rev=4533&view=rev Author: akirschbaum Date: 2008-07-28 08:11:12 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getGlobalSettings(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:01:34 UTC (rev 4532) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:11:12 UTC (rev 4533) @@ -319,7 +319,7 @@ getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent")); + final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:01:34 UTC (rev 4532) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:11:12 UTC (rev 4533) @@ -402,7 +402,7 @@ } } - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent")); + final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:01:34 UTC (rev 4532) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:11:12 UTC (rev 4533) @@ -30,6 +30,7 @@ import javax.swing.ImageIcon; import javax.swing.JMenu; import javax.swing.KeyStroke; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -59,14 +60,20 @@ @Nullable private final JMenu recentMenu; + /** The global settings instance. */ + @NotNull + private final GlobalSettings globalSettings; + /** * Create a new instance. * @param mainControl the main control * @param recentMenu menu for managing the recent entries + * @param globalSettings the global settings instance */ - public RecentManager(@NotNull final MainControl<?, ?, ?, ?> mainControl, @Nullable final JMenu recentMenu) { + public RecentManager(@NotNull final MainControl<?, ?, ?, ?> mainControl, @Nullable final JMenu recentMenu, @NotNull final GlobalSettings globalSettings) { this.mainControl = mainControl; this.recentMenu = recentMenu; + this.globalSettings = globalSettings; } /** @@ -162,14 +169,14 @@ private String getShortFileName() { final File file = new File(filename); try { - if (file.getCanonicalPath().startsWith(mainControl.getGlobalSettings().getMapDir().getCanonicalPath())) { - return file.getCanonicalPath().substring(mainControl.getGlobalSettings().getMapDir().getCanonicalPath().length()).replace('\\', '/'); + if (file.getCanonicalPath().startsWith(globalSettings.getMapDir().getCanonicalPath())) { + return file.getCanonicalPath().substring(globalSettings.getMapDir().getCanonicalPath().length()).replace('\\', '/'); } else { return file.getCanonicalPath().replace('\\', '/'); } } catch (final IOException e) { - if (file.getAbsolutePath().startsWith(mainControl.getGlobalSettings().getMapDir().getAbsolutePath())) { - return file.getAbsolutePath().substring(mainControl.getGlobalSettings().getMapDir().getAbsolutePath().length()).replace('\\', '/'); + if (file.getAbsolutePath().startsWith(globalSettings.getMapDir().getAbsolutePath())) { + return file.getAbsolutePath().substring(globalSettings.getMapDir().getAbsolutePath().length()).replace('\\', '/'); } else { return file.getAbsolutePath().replace('\\', '/'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 08:16:26
|
Revision: 4534 http://gridarta.svn.sourceforge.net/gridarta/?rev=4534&view=rev Author: akirschbaum Date: 2008-07-28 08:16:34 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapPreviewAccessory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:11:12 UTC (rev 4533) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:16:34 UTC (rev 4534) @@ -319,7 +319,7 @@ getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings); + final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:11:12 UTC (rev 4533) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:16:34 UTC (rev 4534) @@ -402,7 +402,7 @@ } } - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings); + final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:11:12 UTC (rev 4533) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:16:34 UTC (rev 4534) @@ -32,6 +32,7 @@ import javax.swing.KeyStroke; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; +import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,15 +66,23 @@ private final GlobalSettings globalSettings; /** + * The map preview accessory instance. + */ + @NotNull + private MapPreviewAccessory mapPreviewAccessory; + + /** * Create a new instance. * @param mainControl the main control * @param recentMenu menu for managing the recent entries * @param globalSettings the global settings instance + * @param mapPreviewAccessory the map preview accessory instance */ - public RecentManager(@NotNull final MainControl<?, ?, ?, ?> mainControl, @Nullable final JMenu recentMenu, @NotNull final GlobalSettings globalSettings) { + public RecentManager(@NotNull final MainControl<?, ?, ?, ?> mainControl, @Nullable final JMenu recentMenu, @NotNull final GlobalSettings globalSettings, @NotNull final MapPreviewAccessory mapPreviewAccessory) { this.mainControl = mainControl; this.recentMenu = recentMenu; this.globalSettings = globalSettings; + this.mapPreviewAccessory = mapPreviewAccessory; } /** @@ -212,7 +221,7 @@ */ @Nullable private ImageIcon getIcon() { - return mainControl.getMapPreviewAccessory().getMapIcon(new File(filename)); + return mapPreviewAccessory.getMapIcon(new File(filename)); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 08:23:50
|
Revision: 4535 http://gridarta.svn.sourceforge.net/gridarta/?rev=4535&view=rev Author: akirschbaum Date: 2008-07-28 08:23:58 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapManager(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:16:34 UTC (rev 4534) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:23:58 UTC (rev 4535) @@ -319,7 +319,7 @@ getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + final RecentManager recentManager = new RecentManager(getMapManager(), (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:16:34 UTC (rev 4534) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:23:58 UTC (rev 4535) @@ -402,7 +402,7 @@ } } - final RecentManager recentManager = new RecentManager(this, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + final RecentManager recentManager = new RecentManager(getMapManager(), (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); getMapManager().setRecentManager(recentManager); // browse arch archive Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:16:34 UTC (rev 4534) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-07-28 08:23:58 UTC (rev 4535) @@ -32,6 +32,7 @@ import javax.swing.KeyStroke; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -51,7 +52,7 @@ /** The main control. */ @NotNull - private final MainControl<?, ?, ?, ?> mainControl; + private final MapManager<?, ?, ?, ?> mapManager; /** List with recents. */ @SuppressWarnings({"CollectionDeclaredAsConcreteClass"}) @@ -73,13 +74,13 @@ /** * Create a new instance. - * @param mainControl the main control + * @param mapManager the map manager instance * @param recentMenu menu for managing the recent entries * @param globalSettings the global settings instance * @param mapPreviewAccessory the map preview accessory instance */ - public RecentManager(@NotNull final MainControl<?, ?, ?, ?> mainControl, @Nullable final JMenu recentMenu, @NotNull final GlobalSettings globalSettings, @NotNull final MapPreviewAccessory mapPreviewAccessory) { - this.mainControl = mainControl; + public RecentManager(@NotNull final MapManager<?, ?, ?, ?> mapManager, @Nullable final JMenu recentMenu, @NotNull final GlobalSettings globalSettings, @NotNull final MapPreviewAccessory mapPreviewAccessory) { + this.mapManager = mapManager; this.recentMenu = recentMenu; this.globalSettings = globalSettings; this.mapPreviewAccessory = mapPreviewAccessory; @@ -212,7 +213,7 @@ /** {@inheritDoc} */ public void actionPerformed(final ActionEvent e) { - mainControl.getMapManager().openMapFileWithView(new File(filename), null); + mapManager.openMapFileWithView(new File(filename), null); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 08:37:12
|
Revision: 4538 http://gridarta.svn.sourceforge.net/gridarta/?rev=4538&view=rev Author: akirschbaum Date: 2008-07-28 08:37:19 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMainView(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:27:58 UTC (rev 4537) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:37:19 UTC (rev 4538) @@ -286,7 +286,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - mapActions = new MapActions(this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-07-28 08:27:58 UTC (rev 4537) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-07-28 08:37:19 UTC (rev 4538) @@ -24,6 +24,7 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.map.MapPropertiesDialog; import cfeditor.map.MapArchObject; +import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; @@ -100,6 +101,12 @@ /** Indicates whether autojoining is on/off. */ private boolean autoJoin; + /** + * The component for showing dialog boxes. + */ + @NotNull + private final Component parent; + /** The main control to use. */ private final CMainControl mainControl; @@ -123,13 +130,15 @@ /** * Create a new instance. + * @param parent the component for showing dialog boxes * @param mainControl the main control to use * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + this.parent = parent; this.mainControl = mainControl; this.mapManager = mapManager; this.exitMatcher = exitMatcher; @@ -341,10 +350,10 @@ // path points to the same map if (destinationPoint != null) { if (destinationPoint.x == 0 && destinationPoint.y == 0) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitNowhere"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); } else if (!currentMap.getMapModel().isPointValid(destinationPoint)) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitOutside"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); } else { currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); } @@ -358,7 +367,7 @@ // destination is a random map; extract the final non-random map final String destinationMap = getRandomMapParameter(exit, "final_map"); if (destinationMap == null) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitRandomDestination"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); return; } newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), destinationMap); @@ -369,7 +378,7 @@ } else { // we have a relative path: if (currentMap.getMapFile() == null) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitNotSaved"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitNotSaved"); return; } newfile = new File(currentMap.getMapFile().getParent(), path); @@ -378,7 +387,7 @@ if (!newfile.exists() || newfile.isDirectory()) { // The path is wrong // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitInvalidPath", newfile.getAbsolutePath()); + ACTION_FACTORY.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); return; } @@ -390,7 +399,7 @@ try { canonicalNewFile = newfile.getCanonicalFile(); } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterTileIOException", newfile.getAbsolutePath()); + ACTION_FACTORY.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); return; } final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); @@ -409,7 +418,7 @@ newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); } - if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { + if (ACTION_FACTORY.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:27:58 UTC (rev 4537) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:37:19 UTC (rev 4538) @@ -347,7 +347,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - mapActions = new MapActions(this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); archetypeTypeSet.loadTypesFromXML(filename); Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-07-28 08:27:58 UTC (rev 4537) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-07-28 08:37:19 UTC (rev 4538) @@ -24,6 +24,7 @@ import daieditor.gui.map.CMapViewBasic; import daieditor.gui.map.MapPropertiesDialog; import daieditor.map.MapArchObject; +import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; @@ -96,6 +97,12 @@ /** Indicates whether autojoining is on/off. */ private boolean autoJoin; + /** + * The component for showing dialog boxes. + */ + @NotNull + private final Component parent; + /** The main control to use. */ private final CMainControl mainControl; @@ -119,13 +126,15 @@ /** * Create a new instance. + * @param parent the component for showing dialog boxes * @param mainControl the main control to use * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + this.parent = parent; this.mainControl = mainControl; this.mapManager = mapManager; this.exitMatcher = exitMatcher; @@ -340,7 +349,7 @@ } else { // we have a relative path: if (currentMap.getMapFile() == null) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitNotSaved"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitNotSaved"); return; } newfile = new File(currentMap.getMapFile().getParent(), path); @@ -349,12 +358,12 @@ // path points to the same map if (destinationPoint != null) { if (destinationPoint.x == 0 && destinationPoint.y == 0) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitNowhere"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); } else if (currentMap.getMapModel().isPointValid(destinationPoint)) { currentMapView.getMapViewBasic().setCursorPosition(destinationPoint); } else { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitOutside"); + ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); } } return; @@ -363,7 +372,7 @@ if (!newfile.exists() || newfile.isDirectory()) { // The path is wrong // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitInvalidPath", newfile.getAbsolutePath()); + ACTION_FACTORY.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); return; } @@ -375,7 +384,7 @@ try { canonicalNewFile = newfile.getCanonicalFile(); } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterTileIOException", newfile.getAbsolutePath()); + ACTION_FACTORY.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); return; } final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); @@ -394,7 +403,7 @@ newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); } - if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { + if (ACTION_FACTORY.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 08:44:17
|
Revision: 4539 http://gridarta.svn.sourceforge.net/gridarta/?rev=4539&view=rev Author: akirschbaum Date: 2008-07-28 08:44:21 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove unused 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-07-28 08:37:19 UTC (rev 4538) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:44:21 UTC (rev 4539) @@ -190,8 +190,6 @@ /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; - private final MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapCursorControl; - /** Actions used by this instance. */ private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions; @@ -226,7 +224,7 @@ final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); PathManager.setGlobalSettings(globalSettings); @@ -813,10 +811,6 @@ return archetypeParser; } - public MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapCursorControl() { - return mapCursorControl; - } - /** {@inheritDoc} */ @NotNull public String getConfigurationDirectory() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:37:19 UTC (rev 4538) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:44:21 UTC (rev 4539) @@ -249,8 +249,6 @@ /** The ViewGameObjectMatcherManager for alpha. */ private final ViewGameObjectMatcherManager vaommAlpha = new ViewGameObjectMatcherManager(moaomAlpha); - private final MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapCursorControl; - /** Actions used by this instance. */ private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions; @@ -282,7 +280,7 @@ final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); @@ -995,10 +993,6 @@ return archetypeParser; } - public MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapCursorControl() { - return mapCursorControl; - } - /** {@inheritDoc} */ @NotNull public String getConfigurationDirectory() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 09:02:13
|
Revision: 4540 http://gridarta.svn.sourceforge.net/gridarta/?rev=4540&view=rev Author: akirschbaum Date: 2008-07-28 09:02:19 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove MainControl.isAutoJoin(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/MapActions.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -236,7 +236,6 @@ mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); @@ -285,6 +284,7 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); @@ -824,11 +824,6 @@ } /** {@inheritDoc} */ - public boolean isAutoJoin() { - return mapActions.isAutoJoin(); - } - - /** {@inheritDoc} */ public ObjectChooser<GameObject, MapArchObject, Archetype> getObjectChooser() { return objectChooser; } Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -36,6 +36,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -90,6 +91,10 @@ @NotNull private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + /** The {@link MapActions} instance to use. */ + @NotNull + private MapActions mapActions = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -131,13 +136,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @@ -153,13 +158,14 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; this.editTypes = editTypes; this.mapImageCache = mapImageCache; + this.mapActions = mapActions; } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -54,7 +54,7 @@ * Manages actions in the "map" menu. * @author Andreas Kirschbaum */ -public class MapActions { +public class MapActions implements net.sf.gridarta.MapActions { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); @@ -247,11 +247,7 @@ } } - /** - * Action method for "autojoin". - * @return <code>true</code> if autojoining is enabled, or - * <code>false</code> if autojoining is disabled - */ + /** {@inheritDoc} */ public boolean isAutoJoin() { return autoJoin; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -294,7 +294,6 @@ mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); @@ -346,6 +345,7 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); archetypeTypeSet.loadTypesFromXML(filename); @@ -1006,11 +1006,6 @@ } /** {@inheritDoc} */ - public boolean isAutoJoin() { - return mapActions.isAutoJoin(); - } - - /** {@inheritDoc} */ public ObjectChooser<GameObject, MapArchObject, Archetype> getObjectChooser() { return objectChooser; } Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -36,6 +36,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -93,6 +94,10 @@ @NotNull private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + /** The {@link MapActions} instance to use. */ + @NotNull + private MapActions mapActions = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -134,13 +139,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); mapArchObject.setDifficulty(1); return mapControl; } @@ -158,7 +163,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; @@ -166,6 +171,7 @@ this.mainControl = mainControl; this.editTypes = editTypes; this.mapImageCache = mapImageCache; + this.mapActions = mapActions; } } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -53,7 +53,7 @@ * Manages actions in the "map" menu. * @author Andreas Kirschbaum */ -public class MapActions { +public class MapActions implements net.sf.gridarta.MapActions { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); @@ -243,11 +243,6 @@ } } - /** - * Action method for "autojoin". - * @return <code>true</code> if autojoining is enabled, or - * <code>false</code> if autojoining is disabled - */ public boolean isAutoJoin() { return autoJoin; } Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -140,7 +140,8 @@ * @param mainControl the main control instance * @param editTypes the edit types instance * @param mapImageCache the map image cache instance + * @param mapActions the map actions instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -216,13 +216,6 @@ AutojoinLists<G, A, R> getAutojoinLists(); /** - * Determine whether autojoining is enabled. - * @return <code>true</code> if autojoining is enabled, or - * <code>false</code> if autojoining is disabled - */ - boolean isAutoJoin(); - - /** * Return the insertion object chooser. * @return the insertion object chooser */ Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -30,6 +30,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; @@ -154,14 +155,15 @@ * @param isPickmap true if this is a pickmap * @param exitTypeGameObjectMatcher the matcher to select exit objects * @param archetypeChooserControl the archeype chooser control to use + * @param mapActions the map actions to use */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapActions mapActions) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; // we create model (= data) - mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl); + mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); mapModel.addMapModelListener(mapModelListener); } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -28,6 +28,7 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.AutojoinList; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapActions; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -139,6 +140,10 @@ @NotNull private ErrorCollector<G, A, R> errors = new DefaultErrorCollector<G, A, R>(); + /** The map actions to use. */ + @NotNull + private final MapActions mapActions; + /** * Create an DefaultMapModel. * @param mainControl main controller @@ -148,13 +153,15 @@ * @param mapArchObject The MapArchObject to associate with this model. * @param exitTypeGameObjectMatcher the matcher for selecting exit objects * @param archetypeChooserControl the archetype chooser control + * @param mapActions the map actions to use */ - public DefaultMapModel(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl) { + public DefaultMapModel(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, @NotNull final MapActions mapActions) { this.mapControl = mapControl; this.mapArchObject = mapArchObject; this.mainControl = mainControl; this.archetypeChooserControl = archetypeChooserControl; this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; + this.mapActions = mapActions; mapSize = mapArchObject.getMapSize(); mapGrid = new MapSquare[mapSize.getWidth()][mapSize.getHeight()]; beginTransaction("init"); @@ -594,7 +601,7 @@ // do autojoining final R archetype = gameObject.getArchetype(); - if (mainControl.isAutoJoin() && join && !archetype.isMulti()) { + if (mapActions.isAutoJoin() && join && !archetype.isMulti()) { final AutojoinList<G, A, R> autojoinList = mainControl.getAutojoinLists().getAutojoinList(archetype); if (autojoinList != null) { // remove connections to the deleted arch @@ -716,7 +723,7 @@ return null; } - if (mainControl.isAutoJoin() && join && !archetype.isMulti()) { + if (mapActions.isAutoJoin() && join && !archetype.isMulti()) { final AutojoinList<G, A, R> autojoinList = mainControl.getAutojoinLists().getAutojoinList(archetype); if (autojoinList != null) { // do autojoining if enabled Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 08:44:21 UTC (rev 4539) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 09:02:19 UTC (rev 4540) @@ -35,6 +35,7 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; @@ -387,8 +388,9 @@ final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, archetypeSet, false); final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test"); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, mapManager, null, new ImageIcon(), new ImageIcon()); - final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl); + final MapActions mapActions = new TestMapActions(); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl, mapActions); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl, mapActions); result.setLength(0); mapModel.addMapModelListener(mapModelListener); @@ -512,11 +514,6 @@ } /** {@inheritDoc} */ - public boolean isAutoJoin() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> getObjectChooser() { throw new AssertionError(); } @@ -543,9 +540,10 @@ * @param isPickmap whether this map control is a pickmap * @param exitTypeGameObjectMatcher the exit matcher to use * @param archetypeChooserControl the archetype chooser control to use + * @param mapActions the map actions to use */ - public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl) { - super(gridartaObjectsFactory, mainControl, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl); + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final MapActions mapActions) { + super(gridartaObjectsFactory, mainControl, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); } } @@ -934,7 +932,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { throw new AssertionError(); } } @@ -976,4 +974,16 @@ } + /** + * An {@link MapActions} implementation for testing purposes. + */ + private static class TestMapActions implements MapActions { + + /** {@inheritDoc} */ + public boolean isAutoJoin() { + return false; + } + + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 09:02:57
|
Revision: 4541 http://gridarta.svn.sourceforge.net/gridarta/?rev=4541&view=rev Author: akirschbaum Date: 2008-07-28 09:03:05 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove CMainControl.mapActions. 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-07-28 09:02:19 UTC (rev 4540) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) @@ -148,8 +148,6 @@ /** Preferences default value for using System.exit(). */ public static final boolean PREFS_SYSTEM_EXIT_DEFAULT = true; - private final MapActions mapActions; - /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser; @@ -283,7 +281,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 09:02:19 UTC (rev 4540) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) @@ -186,8 +186,6 @@ /** Preferences default value for editor application. */ public static final String PREFS_APP_EDITOR_DEFAULT = "vim"; - private final MapActions mapActions; - /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser; @@ -344,7 +342,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 11:03:58
|
Revision: 4542 http://gridarta.svn.sourceforge.net/gridarta/?rev=4542&view=rev Author: akirschbaum Date: 2008-07-28 11:04:02 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeParser(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/io/GameObjectParser.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/io/GameObjectParser.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -282,7 +282,6 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); @@ -300,6 +299,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -95,6 +96,10 @@ @NotNull private MapActions mapActions = null; + /** The {@link ArchetypeParser} instance to use. */ + @NotNull + private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -130,7 +135,7 @@ /** {@inheritDoc} */ public GameObjectParser newGameObjectParser() { - return new GameObjectParser(this); + return new GameObjectParser(this, archetypeParser); } /** {@inheritDoc} */ @@ -158,7 +163,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; @@ -166,6 +171,7 @@ this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; + this.archetypeParser = archetypeParser; } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/io/GameObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -29,6 +29,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.regex.Pattern; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.io.AbstractGameObjectParser; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -332,9 +333,10 @@ * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - public GameObjectParser(@NotNull final CrossfireObjectsFactory gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public GameObjectParser(@NotNull final CrossfireObjectsFactory gridartaObjectsFactory, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + super(gridartaObjectsFactory, archetypeParser); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -343,7 +343,6 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); archetypeTypeSet.loadTypesFromXML(filename); @@ -359,6 +358,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -98,6 +99,10 @@ @NotNull private MapActions mapActions = null; + /** The {@link ArchetypeParser} instance to use. */ + @NotNull + private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -133,7 +138,7 @@ /** {@inheritDoc} */ public GameObjectParser newGameObjectParser() { - return new GameObjectParser(this); + return new GameObjectParser(this, archetypeParser); } /** {@inheritDoc} */ @@ -163,7 +168,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; @@ -172,6 +177,7 @@ this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; + this.archetypeParser = archetypeParser; } } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/io/GameObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -25,6 +25,7 @@ import daieditor.map.MapArchObject; import java.io.IOException; import java.util.Formatter; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.io.AbstractGameObjectParser; import org.jetbrains.annotations.NotNull; @@ -39,9 +40,10 @@ * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - public GameObjectParser(@NotNull final DaimoninObjectsFactory gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public GameObjectParser(@NotNull final DaimoninObjectsFactory gridartaObjectsFactory, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + super(gridartaObjectsFactory, archetypeParser); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -24,6 +24,7 @@ import java.io.FileNotFoundException; import java.util.List; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -141,7 +142,8 @@ * @param editTypes the edit types instance * @param mapImageCache the map image cache instance * @param mapActions the map actions instance + * @param archetypeParser the archetype parser instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @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); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -30,6 +30,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -52,13 +53,19 @@ @NotNull private final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; + /** The archetype parser to use. */ + @NotNull + private final ArchetypeParser<G, A, R> archetypeParser; + /** * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - protected AbstractGameObjectParser(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory) { + protected AbstractGameObjectParser(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory, @NotNull final ArchetypeParser<G, A, R> archetypeParser) { this.gridartaObjectsFactory = gridartaObjectsFactory; + this.archetypeParser = archetypeParser; } /** {@inheritDoc} */ @@ -192,7 +199,7 @@ gameObject.setObjectFace(); if (!gameObject.isInContainer()) { - mainControl.getArchetypeParser().expandMulti(gameObject, tailList); + archetypeParser.expandMulti(gameObject, tailList); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -932,7 +932,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { 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-07-28 19:55:54
|
Revision: 4548 http://gridarta.svn.sourceforge.net/gridarta/?rev=4548&view=rev Author: akirschbaum Date: 2008-07-28 19:55:59 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Unify code; improves CrossfireEditor's map rendering performance. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainControlInstance.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.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/map/DefaultMapControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -215,6 +215,7 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor"); + CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects, globalSettings.getImageSet()); @@ -773,7 +774,7 @@ JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel(), archetypeSet).getFullImage()); + new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/CMainControlInstance.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControlInstance.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/CMainControlInstance.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -28,7 +28,7 @@ /** * The singleton instance. */ - private static CMainControl instance = null; + static CMainControl instance = null; /** * Private constructor to prevent instantiation. Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -39,7 +39,6 @@ import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeParser; -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.DefaultObjectChooser; @@ -152,8 +151,8 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - return new SimpleLevelRenderer(mapModel, archetypeSet); + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { + return new SimpleLevelRenderer(mapModel); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -19,8 +19,10 @@ package cfeditor.gameobject; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.scripts.ScriptArchData; import cfeditor.map.MapArchObject; +import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; @@ -59,6 +61,9 @@ @NotNull private ScriptArchData scriptArchData = new ScriptArchData(this); + /** The normal face. */ + private ImageIcon normalFace; + /** {@inheritDoc} */ @Override public void propagateElevation(@NotNull final GameObject gameObject) { @@ -94,8 +99,20 @@ /** {@inheritDoc} */ public void setObjectFace() { + if (!isArchetype()) { + final ArchetypeSet archetypeSet = CMainControlInstance.getInstance().getArchetypeSet(); + normalFace = archetypeSet.getFace(this); + } } + /** + * Returns the normal face for this GameObject. + * @return The normal face for this GameObject. + */ + public ImageIcon getNormalImage() { + return normalFace; + } + // lore text @NotNull public String getLoreText() { @@ -155,6 +172,7 @@ clone.archType = archType; // type attribute of the arch clone.scriptArchData = new ScriptArchData(clone); + clone.normalFace = normalFace; clone.setMapX(posx); clone.setMapY(posy); @@ -270,7 +288,8 @@ && (gameObject.animText == null ? animText == null : gameObject.animText.equals(animText)) && gameObject.loreText.equals(loreText) // ignore "scriptArchData" - && gameObject.archType == archType; + && gameObject.archType == archType + && gameObject.normalFace == normalFace; } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -22,7 +22,6 @@ import cfeditor.CFilterControl; import cfeditor.CMainControl; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.awt.Color; @@ -76,8 +75,6 @@ @NotNull private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; - private final ArchetypeSet archetypeSet; - /** * Create a new instance. * @param mainControl MainControl, used for getting icons and similar @@ -90,7 +87,6 @@ filter = mainControl.getFilterControl(); this.mainControl = mainControl; this.editTypes = editTypes; - archetypeSet = mainControl.getArchetypeSet(); addMouseMotionListener(mainControl.getMainView().getStatusBar()); init(); } @@ -210,7 +206,8 @@ if (!editTypes.isEditType(node)) { continue; } - final ImageIcon img = archetypeSet.getFace(node); + final ImageIcon img = node.getNormalImage(); + assert img != null; if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { offset.x = 0; offset.y = 0; Modified: trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -21,7 +21,6 @@ import cfeditor.CMainControl; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.awt.Color; @@ -43,8 +42,6 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - private final ArchetypeSet archetypeSet; - /** * Create a new instance. * @param mainControl MainControl, used for getting icons and similar @@ -53,7 +50,6 @@ */ public PickmapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { super(mapControl, mapGrid, 0); - archetypeSet = mainControl.getArchetypeSet(); init(); } @@ -103,7 +99,7 @@ } for (final GameObject node : mapModel.getMapSquare(point)) { - final ImageIcon img = archetypeSet.getFace(node); + final ImageIcon img = node.getNormalImage(); final int x, y; if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { x = 0; Modified: trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -30,7 +30,6 @@ import java.util.Map; import javax.swing.ImageIcon; import net.sf.gridarta.Size2D; -import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.map.MapModel; @@ -52,21 +51,15 @@ @NotNull private final MapModel<GameObject, MapArchObject, Archetype> mapModel; - /** The archetype set to use. */ - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - /** Temporary variable. */ private final Point offset = new Point(); /** * Create a SimpleLevelRenderer. * @param mapModel the map model to render - * @param archetypeSet the archetype set to use */ - public SimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public SimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { this.mapModel = mapModel; - this.archetypeSet = archetypeSet; } /** {@inheritDoc} */ @@ -117,7 +110,7 @@ } for (final GameObject node : mapModel.getMapSquare(point)) { - final ImageIcon img = archetypeSet.getFace(node); + final ImageIcon img = node.getNormalImage(); if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)) { offset.x = 0; offset.y = 0; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -955,7 +955,7 @@ JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel(), archetypeSet).getFullImage()); + new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -39,7 +39,6 @@ import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeParser; -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.DefaultObjectChooser; @@ -157,7 +156,7 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { return new SimpleLevelRenderer(mapModel); } Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -115,11 +115,10 @@ /** * Create a new level renderer instance. * @param mapModel the map model to render - * @param archetypeSet the archetype set * @return the new level renderer */ @NotNull - LevelRenderer newSimpleLevelRenderer(@NotNull MapModel<G, A, R> mapModel, @NotNull ArchetypeSet<G, A, R> archetypeSet); + LevelRenderer newSimpleLevelRenderer(@NotNull MapModel<G, A, R> mapModel); /** * Creates a new map view instance for a map control. Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -388,7 +388,7 @@ final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); final LevelRenderer levelRenderer; if (tmpLevelRenderer == null) { - levelRenderer = gridartaObjectsFactory.newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); + levelRenderer = gridartaObjectsFactory.newSimpleLevelRenderer(mapModel); levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); } else { levelRenderer = tmpLevelRenderer; Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 19:27:52 UTC (rev 4547) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 19:55:59 UTC (rev 4548) @@ -921,7 +921,7 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeMapModel, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeArchetypeSet) { + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeMapModel) { 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-07-28 20:40:37
|
Revision: 4549 http://gridarta.svn.sourceforge.net/gridarta/?rev=4549&view=rev Author: akirschbaum Date: 2008-07-28 20:40:45 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove dependency MapRenderer -> StatusBar. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/daimonin/src/daieditor/gui/map/MapRenderer.java trunk/src/app/net/sf/gridarta/gui/StatusBar.java trunk/src/app/net/sf/gridarta/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) +++ trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-28 20:40:45 UTC (rev 4549) @@ -87,19 +87,11 @@ filter = mainControl.getFilterControl(); this.mainControl = mainControl; this.editTypes = editTypes; - addMouseMotionListener(mainControl.getMainView().getStatusBar()); init(); } /** {@inheritDoc} */ @Override - public void closeNotify() { - removeMouseMotionListener(mainControl.getMainView().getStatusBar()); - super.closeNotify(); - } - - /** {@inheritDoc} */ - @Override protected void updateTile(final Point point) { final BufferedImage backBuffer = getBackBufferImage(); if (backBuffer == null) { Modified: trunk/daimonin/src/daieditor/gui/map/MapRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) +++ trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-07-28 20:40:45 UTC (rev 4549) @@ -63,18 +63,10 @@ super(mainControl, mapControl, mapGrid, IGUIConstants.TILE_ISO_XLEN, 2 * IGUIConstants.TILE_ISO_YLEN, faceObjects); this.mainControl = mainControl; this.editTypes = editTypes; - addMouseMotionListener(mainControl.getMainView().getStatusBar()); } /** {@inheritDoc} */ @Override - public void closeNotify() { - removeMouseMotionListener(mainControl.getMainView().getStatusBar()); - super.closeNotify(); - } - - /** {@inheritDoc} */ - @Override protected void clearBackground(@NotNull final Graphics grfx) { } Modified: trunk/src/app/net/sf/gridarta/gui/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-28 19:55:59 UTC (rev 4548) +++ trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-28 20:40:45 UTC (rev 4549) @@ -132,7 +132,7 @@ /** {@inheritDoc} */ public void mapViewCreated(@NotNull final MapView<G, A, R, V> mapView) { - // ignore + mapView.getMapViewBasic().getRenderer().addMouseMotionListener(StatusBar.this); } /** {@inheritDoc} */ @@ -142,7 +142,7 @@ /** {@inheritDoc} */ public void mapViewClosing(@NotNull final MapView<G, A, R, V> mapView) { - // ignore + mapView.getMapViewBasic().getRenderer().removeMouseMotionListener(StatusBar.this); } }; Modified: trunk/src/app/net/sf/gridarta/gui/map/LevelRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/LevelRenderer.java 2008-07-28 19:55:59 UTC (rev 4548) +++ trunk/src/app/net/sf/gridarta/gui/map/LevelRenderer.java 2008-07-28 20:40:45 UTC (rev 4549) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map; import java.awt.Point; +import java.awt.event.MouseMotionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -75,4 +76,16 @@ */ void printFullImage(File file) throws IOException; + /** + * Adds a {@link MouseMotionListener} to be notified about mouse events. + * @param mouseMotionListener the listener to add + */ + void addMouseMotionListener(@NotNull final MouseMotionListener mouseMotionListener); + + /** + * Removes a {@link MouseMotionListener} to be notified about mouse events. + * @param mouseMotionListener the listener to remove + */ + void removeMouseMotionListener(@NotNull final MouseMotionListener mouseMotionListener); + } // interface LevelRenderer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 21:04:08
|
Revision: 4550 http://gridarta.svn.sourceforge.net/gridarta/?rev=4550&view=rev Author: akirschbaum Date: 2008-07-28 21:04:16 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove status bar updates while startup -- they are not shown. 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-07-28 20:40:45 UTC (rev 4549) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 21:04:16 UTC (rev 4550) @@ -301,7 +301,6 @@ scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); - mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -330,15 +329,11 @@ } scriptControl.loadScripts(new File(globalSettings.getMapDir(), IGUIConstants.SCRIPTS_DIR)); - mainView.getStatusBar().setStatusText("Sorting..."); archetypeChooserControl.finishBuildProcess(); // load the autojoin lists - mainView.getStatusBar().setStatusText("Loading Autojoin Tables..."); getAutojoinLists().loadList(archetypeSet, getConfigurationDirectory()); - mainView.getStatusBar().setStatusText("Ready."); - if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 20:40:45 UTC (rev 4549) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 21:04:16 UTC (rev 4550) @@ -359,7 +359,6 @@ mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); - mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -404,15 +403,11 @@ // browse arch archive // load object from a arch file you found - mainView.getStatusBar().setStatusText("Sorting..."); archetypeChooserControl.finishBuildProcess(); // load the autojoin lists - mainView.getStatusBar().setStatusText("Loading Autojoin Tables..."); getAutojoinLists().loadList(archetypeSet, getConfigurationDirectory()); - mainView.getStatusBar().setStatusText("Ready."); - if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-28 21:43:16
|
Revision: 4557 http://gridarta.svn.sourceforge.net/gridarta/?rev=4557&view=rev Author: akirschbaum Date: 2008-07-28 21:43:24 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove dependency MainView -> FaceObjects. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 21:32:17 UTC (rev 4556) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 21:43:24 UTC (rev 4557) @@ -69,6 +69,7 @@ import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; +import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; @@ -234,8 +235,9 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); - createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); + createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 21:32:17 UTC (rev 4556) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 21:43:24 UTC (rev 4557) @@ -78,6 +78,7 @@ import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; +import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; @@ -291,8 +292,9 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); - createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); + createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-28 21:32:17 UTC (rev 4556) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-28 21:43:24 UTC (rev 4557) @@ -30,6 +30,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -145,9 +146,10 @@ * for a map. * @param defaultPreview The default preview image to return if no preview * can be created for a map. + * @param statusBar the status bar instance */ - protected void createMapImageCache(@Nullable final File baseDir, @NotNull final ImageIcon defaultIcon, @NotNull final ImageIcon defaultPreview) { - mapImageCache = new MapImageCache<G, A, R, V>(getMainView().getStatusBar(), mapManager, baseDir, defaultIcon, defaultPreview); + protected void createMapImageCache(@Nullable final File baseDir, @NotNull final ImageIcon defaultIcon, @NotNull final ImageIcon defaultPreview, @NotNull final StatusBar<G, A, R, V> statusBar) { + mapImageCache = new MapImageCache<G, A, R, V>(statusBar, mapManager, baseDir, defaultIcon, defaultPreview); mapPreviewAccessory = new MapPreviewAccessory(mapImageCache); } Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-28 21:32:17 UTC (rev 4556) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-28 21:43:24 UTC (rev 4557) @@ -49,7 +49,6 @@ import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.MapFileActions; @@ -239,13 +238,13 @@ * @param mapManager the map manager * @param actionFactory the action factory to use * @param aCloseAll the action "close all map windows" - * @param faceObjects the FaceObjects instance to use + * @param statusBar the status bar instance */ - public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final FaceObjects faceObjects) { + public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final StatusBar<G, A, R, V> statusBar) { super(actionFactory.format("mainWindow.title", AbstractMainControl.getBuildNumberAsString())); this.mapManager = mapManager; mapFileAction = new MapFileActions<G, A, R, V>(mainControl, mapManager, null); - statusBar = new StatusBar<G, A, R, V>(mainControl, faceObjects); + this.statusBar = statusBar; add(statusBar, BorderLayout.SOUTH); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 07:30:41
|
Revision: 4566 http://gridarta.svn.sourceforge.net/gridarta/?rev=4566&view=rev Author: akirschbaum Date: 2008-07-29 07:30:49 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Move call to GameObjectAttributesPanel.appExitNotify() to CMainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 07:26:53 UTC (rev 4565) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 07:30:49 UTC (rev 4566) @@ -211,6 +211,9 @@ @NotNull private final GameObjectAttributesDialogFactory gameObjectAttributesDialogFactory; + @NotNull + private final GameObjectAttributesPanel gameObjectAttributesPanel; + /** * Constructs the main controller and its model and view. * @throws RuntimeException If the controller cannot be initialized. @@ -298,7 +301,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); - final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); PluginParameterFactory.init(gameObjectAttributesPanel); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); @@ -751,6 +754,7 @@ /** Notifies that the application is about to exit. */ void appExitNotify() { mainView.appExitNotify(); // notify main view + gameObjectAttributesPanel.appExitNotify(); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 07:26:53 UTC (rev 4565) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 07:30:49 UTC (rev 4566) @@ -266,6 +266,9 @@ @NotNull private final GameObjectAttributesDialogFactory gameObjectAttributesDialogFactory; + @NotNull + private final GameObjectAttributesPanel gameObjectAttributesPanel; + /** * Constructs the main controller and its model and view. * @throws RuntimeException If the controller cannot be initialized. @@ -356,7 +359,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER); - final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); @@ -938,6 +941,7 @@ /** Notifies that the application is about to exit. */ void appExitNotify() { mainView.appExitNotify(); // notify main view + gameObjectAttributesPanel.appExitNotify(); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-29 07:26:53 UTC (rev 4565) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-29 07:30:49 UTC (rev 4566) @@ -483,8 +483,6 @@ prefs.putInt(DIVIDER_LOCATION_KEY2, splitDownPane.getDividerLocation()); prefs.putInt(DIVIDER_LOCATION_KEY3, splitRightPane.getDividerLocation()); prefs.putInt(WINDOW_STATE, getExtendedState()); - - gameObjectAttributesPanel.appExitNotify(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 07:39:04
|
Revision: 4568 http://gridarta.svn.sourceforge.net/gridarta/?rev=4568&view=rev Author: akirschbaum Date: 2008-07-29 07:39:12 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Remove MainView.objectChooser. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 07:32:34 UTC (rev 4567) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 07:39:12 UTC (rev 4568) @@ -241,7 +241,7 @@ SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); @@ -303,7 +303,7 @@ final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); PluginParameterFactory.init(gameObjectAttributesPanel); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 07:32:34 UTC (rev 4567) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 07:39:12 UTC (rev 4568) @@ -297,7 +297,7 @@ SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); @@ -360,7 +360,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER); gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-29 07:32:34 UTC (rev 4567) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-07-29 07:39:12 UTC (rev 4568) @@ -146,9 +146,6 @@ /** Action Factory to create Actions. */ private final ActionFactory actionFactory; - /** The panel that contains the object chooser. */ - private final DefaultObjectChooser<G, A, R, V> objectChooser; - /** All open map views. */ private final MapViewManager<G, A, R, V> mapViewManager; @@ -225,13 +222,12 @@ * Constructs the main view and registers the given main controller. * @param mainControl MainControl to attach to. * @param editTypes the edit types instance - * @param objectChooser the object chooser * @param mapManager the map manager * @param actionFactory the action factory to use * @param aCloseAll the action "close all map windows" * @param statusBar the status bar instance */ - public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final StatusBar<G, A, R, V> statusBar) { + public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final StatusBar<G, A, R, V> statusBar) { super(actionFactory.format("mainWindow.title", AbstractMainControl.getBuildNumberAsString())); this.mapManager = mapManager; mapViewManager = new MapViewManager<G, A, R, V>(this); @@ -245,7 +241,6 @@ } }); - this.objectChooser = objectChooser; this.actionFactory = actionFactory; this.aCloseAll = aCloseAll; aPrevWindow = actionFactory.createAction(true, "prevWindow", this); @@ -388,8 +383,9 @@ * bottom monster objects * @param gameObjectMatchers the game object matchers * @param archetypeChooserControl the archetype chooser control + * @param objectChooser the object chooser */ - public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl) { + public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -399,7 +395,7 @@ final JPanel toolbarPanel = new JPanel(new BorderLayout()); toolbarPanel.add(mainToolbar, BorderLayout.NORTH); - toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel), BorderLayout.CENTER); + toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, objectChooser), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, objectChooser, archetypeTypeSet); @@ -437,8 +433,9 @@ * @param selectedSquareView the selected square view * @param mapTileListBottom whether the map tile should be at the bottom * @return center panel + * @param objectChooser the object chooser */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel) { + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { final JPanel centerPanel = new JPanel(new BorderLayout()); final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 07:43:11
|
Revision: 4569 http://gridarta.svn.sourceforge.net/gridarta/?rev=4569&view=rev Author: akirschbaum Date: 2008-07-29 07:43:19 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-07-29 07:39:12 UTC (rev 4568) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-07-29 07:43:19 UTC (rev 4569) @@ -25,7 +25,6 @@ import java.io.File; import java.io.IOException; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -66,12 +65,6 @@ private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl; /** - * The pattern to match end of line characters separating lines in the arch - * text. - */ - private static final Pattern lineSeparatorPattern = Pattern.compile("\n"); - - /** * Creates an ArchetypeParser. * @param mainControl main control * @param archetypeChooserControl an archetype chooser to add parsed Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-07-29 07:39:12 UTC (rev 4568) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-07-29 07:43:19 UTC (rev 4569) @@ -26,7 +26,6 @@ import java.io.File; import java.io.IOException; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -67,12 +66,6 @@ private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl; /** - * The pattern to match end of line characters separating lines in the arch - * text. - */ - private static final Pattern lineSeparatorPattern = Pattern.compile("\n"); - - /** * Creates an ArchetypeParser. * @param mainControl main control * @param archetypeChooserControl an archetype chooser to add parsed Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java 2008-07-29 07:39:12 UTC (rev 4568) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java 2008-07-29 07:43:19 UTC (rev 4569) @@ -24,7 +24,6 @@ import java.io.FileReader; import java.io.IOException; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -42,12 +41,6 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** - * The pattern to match end of line characters separating lines in the arch - * text. - */ - private static final Pattern lineSeparatorPattern = Pattern.compile("\n"); - /** Create an AbstractArchetypeParser. */ protected AbstractArchetypeParser() { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 07:59:59
|
Revision: 4571 http://gridarta.svn.sourceforge.net/gridarta/?rev=4571&view=rev Author: akirschbaum Date: 2008-07-29 08:00:04 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.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-07-29 07:52:14 UTC (rev 4570) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -236,7 +236,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -292,7 +292,7 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -31,6 +31,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; @@ -93,12 +94,14 @@ /** * Creates a new instance. + * @param mainControl the main control + * @param archetypeSet the archetype set * @param editTypes the edit types instance * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; @@ -115,7 +118,7 @@ }); toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); - objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, copyBuffer, this); + objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, archetypeSet, copyBuffer, this); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypePanel()); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -462,7 +462,7 @@ public void replace() { final MapView<G, A, R, V> mapView = getReplaceEnabled(); if (mapView != null) { - ReplaceDialogManager.getInstance(mainControl, copyBuffer, objectChooser).display(mapView); + ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).display(mapView); } } Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -28,6 +28,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; @@ -47,6 +48,10 @@ /** Controller of this subview. */ private final MainControl<G, A, R, V> mainControl; + /** The archetype set. */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + /** The copy buffer instance. */ @NotNull private final CopyBuffer<G, A, R, V> copyBuffer; @@ -71,8 +76,9 @@ private final JLabel archTileText = new JLabel(); - public ObjectChoiceDisplay(final MainControl<G, A, R, V> mainControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public ObjectChoiceDisplay(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) { this.mainControl = mainControl; + this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; setLayout(new GridBagLayout()); @@ -155,8 +161,8 @@ } // notify ReplaceDialog - if (ReplaceDialogManager.isBuilt() && ReplaceDialogManager.getInstance(mainControl, copyBuffer, objectChooser).isShowing()) { - ReplaceDialogManager.getInstance(mainControl, copyBuffer, objectChooser).updateArchSelection(headObject, false); + if (ReplaceDialogManager.isBuilt() && ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).isShowing()) { + ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).updateArchSelection(headObject, false); } } } Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -41,6 +41,7 @@ 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; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -76,6 +77,10 @@ private final MainControl<G, A, R, V> mainControl; + /** The archetype set. */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + /** The edit types instance. */ @NotNull private final CopyBuffer<G, A, R, V> copyBuffer; @@ -119,11 +124,12 @@ * @param mainControl MainControl * @param copyBuffer the copy buffer instance */ - public ReplaceDialog(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { + 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")); dialog.setModal(false); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.mainControl = mainControl; + this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; } @@ -197,7 +203,7 @@ iconLabel = new JLabel(); if (replaceArch != null) { colonLabel = new JLabel(":"); - iconLabel.setIcon(mainControl.getArchetypeSet().getFace(replaceArch)); + iconLabel.setIcon(archetypeSet.getFace(replaceArch)); rfArchName = new JLabel(" " + replaceArch.getBestName()); } else { colonLabel = new JLabel(""); @@ -242,7 +248,7 @@ colonLabel.setText(""); } else { replaceWithBox.setSelectedIndex(0); - iconLabel.setIcon(mainControl.getArchetypeSet().getFace(replaceArch)); + iconLabel.setIcon(archetypeSet.getFace(replaceArch)); rfArchName.setText(" " + replaceArch.getBestName()); colonLabel.setText(":"); } @@ -274,7 +280,7 @@ if (newArch != null) { final Icon oldIcon = iconLabel.getIcon(); - iconLabel.setIcon(mainControl.getArchetypeSet().getFace(newArch)); + iconLabel.setIcon(archetypeSet.getFace(newArch)); rfArchName.setText(" " + newArch.getBestName()); colonLabel.setText(":"); Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-29 07:52:14 UTC (rev 4570) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-29 08:00:04 UTC (rev 4571) @@ -3,6 +3,7 @@ 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; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; @@ -28,9 +29,9 @@ return instance != null && instance.isBuilt(); } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> ReplaceDialog<G, A, R, V> getInstance(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> ReplaceDialog<G, A, R, V> getInstance(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { if (instance == null) { - instance = new ReplaceDialog<G, A, R, V>(mainControl, copyBuffer, objectChooser); + instance = new ReplaceDialog<G, A, R, V>(mainControl, archetypeSet, copyBuffer, objectChooser); } return (ReplaceDialog<G, A, R, V>) instance; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 08:04:38
|
Revision: 4572 http://gridarta.svn.sourceforge.net/gridarta/?rev=4572&view=rev Author: akirschbaum Date: 2008-07-29 08:04:45 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/StatusBar.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 08:00:04 UTC (rev 4571) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 08:04:45 UTC (rev 4572) @@ -239,7 +239,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); - final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 08:00:04 UTC (rev 4571) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 08:04:45 UTC (rev 4572) @@ -295,7 +295,7 @@ objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); - final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/gui/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-29 08:00:04 UTC (rev 4571) +++ trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-07-29 08:04:45 UTC (rev 4572) @@ -32,7 +32,7 @@ import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.border.BevelBorder; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -70,8 +70,9 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** Controller of this statusbar view. */ - private final MainControl<G, A, R, V> mainControl; + /** The archetype set. */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; /** The FaceObjects instance to use. */ @NotNull @@ -183,7 +184,6 @@ /** {@inheritDoc} */ public void actionPerformed(final ActionEvent e) { - final ArchetypeSet<G, A, R> archetypeSet = mainControl.getArchetypeSet(); final int archetypeCount = archetypeSet == null ? 0 : archetypeSet.getArchetypeCount(); final int faceObjectsCount = faceObjects.size(); @@ -201,11 +201,12 @@ /** * Constructs a statusbar that has the given main controller object set as * its controller. - * @param mainControl The MainControl for statistical data. + * @param mapManager the map manager + * @param archetypeSet the archetype set * @param faceObjects the FaceObjects instance to use */ - public StatusBar(final MainControl<G, A, R, V> mainControl, @NotNull final FaceObjects faceObjects) { - this.mainControl = mainControl; + public StatusBar(@NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects) { + this.archetypeSet = archetypeSet; this.faceObjects = faceObjects; setLayout(new GridBagLayout()); setBorder(new BevelBorder(BevelBorder.LOWERED)); @@ -234,7 +235,7 @@ memory.setBorder(new BevelBorder(BevelBorder.LOWERED)); add(memory, gbc); - mainControl.getMapManager().addMapManagerListener(mapManagerListener); + mapManager.addMapManagerListener(mapManagerListener); new Timer(5000, statusBarUpdate).start(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-29 08:19:12
|
Revision: 4573 http://gridarta.svn.sourceforge.net/gridarta/?rev=4573&view=rev Author: akirschbaum Date: 2008-07-29 08:19:17 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java trunk/src/app/net/sf/gridarta/io/GameObjectParser.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -307,7 +307,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -39,6 +39,7 @@ import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeParser; +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.DefaultObjectChooser; @@ -99,6 +100,10 @@ @NotNull private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** The {@link ArchetypeSet} instance. */ + @NotNull + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -118,7 +123,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -162,7 +167,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; @@ -171,6 +176,7 @@ this.mapImageCache = mapImageCache; this.mapActions = mapActions; this.archetypeParser = archetypeParser; + this.archetypeSet = archetypeSet; } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -138,7 +138,7 @@ } reportErrors(mainControl.getMainView()); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, editTypes, invObjects, fname, true); + mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -363,7 +363,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -39,6 +39,7 @@ import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.ArchetypeParser; +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.DefaultObjectChooser; @@ -102,6 +103,10 @@ @NotNull private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** The {@link ArchetypeSet} instance. */ + @NotNull + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -121,7 +126,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -167,7 +172,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @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) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; @@ -177,6 +182,7 @@ this.mapImageCache = mapImageCache; this.mapActions = mapActions; this.archetypeParser = archetypeParser; + this.archetypeSet = archetypeSet; } } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -176,7 +176,7 @@ loadArchesFromArtifacts(archetypeParser, mainControl.getCollectedDirectory() + "/" + IGUIConstants.ARTIFACTS_FILE, "Artifacts", "artifacts", invObjects); loadArchesFromArtifacts(archetypeParser, mainControl.getGlobalSettings().getMapDefaultFolder(), "Artifacts", "maps", invObjects); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, editTypes, invObjects, fname, true); + mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -25,6 +25,7 @@ import java.util.List; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.ObjectChooser; @@ -141,7 +142,8 @@ * @param mapImageCache the map image cache instance * @param mapActions the map actions instance * @param archetypeParser the archetype parser instance + * @param archetypeSet the archetype set instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @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); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @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); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -19,6 +19,7 @@ package net.sf.gridarta.io; +import java.awt.Component; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; @@ -28,9 +29,9 @@ import java.util.TreeSet; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -177,7 +178,7 @@ } /** {@inheritDoc} */ - public void collectTempList(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final EditTypes<G, A, R, ?> editTypes, final List<G> objects, final String uri, final boolean isInteractive) { + public void collectTempList(@NotNull final Component parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final EditTypes<G, A, R, ?> editTypes, final List<G> objects, final String uri, final boolean isInteractive) { final List<G> tailList = new ArrayList<G>(); final Set<String> undefinedArchetypeNames = new TreeSet<String>(); @@ -185,7 +186,7 @@ // first: attach our map sucker to a default arch we have loaded for (final G gameObject : objects) { - final R archetype = mainControl.getArchetypeSet().getOrCreateArchetype(gameObject.getArchetypeName()); + final R archetype = archetypeSet.getOrCreateArchetype(gameObject.getArchetypeName()); gameObject.setArchetype(archetype); if (archetype.isUndefinedArchetype()) { gameObjectsWithoutArchetype.add(gameObject); @@ -212,7 +213,7 @@ for (final String archetypeName : undefinedArchetypeNames) { noarch.append(archetypeName).append('\n'); } - if (ACTION_FACTORY.showQuestionDialog(mainControl.getMainView(), "collectTemplistAutodelete", uri, gameObjectsWithoutArchetype.size(), noarch)) { + if (ACTION_FACTORY.showQuestionDialog(parent, "collectTemplistAutodelete", uri, gameObjectsWithoutArchetype.size(), noarch)) { objects.removeAll(gameObjectsWithoutArchetype); } } Modified: trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -19,6 +19,7 @@ package net.sf.gridarta.io; +import java.awt.Component; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -32,8 +33,8 @@ import java.util.List; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -47,10 +48,22 @@ // myInput.close() is invoked in this.close() public final class DefaultMapReader<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapReader<G, A> { - /** The main control. */ + /** The objects factory instance. */ @NotNull - private final MainControl<G, A, R, ?> mainControl; + private final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; + /** + * The component for showing dialog boxes. + */ + @NotNull + private final Component parent; + + /** + * The archetype set. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + /** The edit types instance. */ @NotNull private final EditTypes<G, A, R, ?> editTypes; @@ -85,13 +98,17 @@ /** * Open a file for reading it as a map. - * @param mainControl The main control. + * @param gridartaObjectsFactory the objects factory instance + * @param parent the parent component for showing dialog boxes + * @param archetypeSet the archetype set * @param editTypes the edit types instance * @param file File to open. * @throws FileNotFoundException in case the file was not found. */ - public DefaultMapReader(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final EditTypes<G, A, R, ?> editTypes, @NotNull final File file) throws FileNotFoundException { - this.mainControl = mainControl; + public DefaultMapReader(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final EditTypes<G, A, R, ?> editTypes, @NotNull final File file) throws FileNotFoundException { + this.gridartaObjectsFactory = gridartaObjectsFactory; + this.parent = parent; + this.archetypeSet = archetypeSet; this.editTypes = editTypes; uri = file.toURI().toString(); try { @@ -127,8 +144,6 @@ /** {@inheritDoc} */ public void decodeMapFile(final boolean isInteractive) throws IOException { - final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory = mainControl.getGridartaObjectsFactory(); - mapArchObject = gridartaObjectsFactory.newMapArchObject(false); gridartaObjectsFactory.newMapArchObjectParser().load(myInput, mapArchObject); @@ -136,7 +151,7 @@ while (gameObjectParser.load(myInput, objects) != null) { } - gameObjectParser.collectTempList(mainControl, editTypes, objects, uri, isInteractive); + gameObjectParser.collectTempList(parent, archetypeSet, editTypes, objects, uri, isInteractive); Collections.sort(objects, sorter); } Modified: trunk/src/app/net/sf/gridarta/io/GameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/GameObjectParser.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/src/app/net/sf/gridarta/io/GameObjectParser.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -19,13 +19,14 @@ package net.sf.gridarta.io; +import java.awt.Component; import java.io.BufferedReader; import java.io.IOException; import java.util.Collection; import java.util.List; import net.sf.gridarta.EditTypes; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -76,13 +77,14 @@ /** * Browse first through the default arch list and attach map arches to it * then browse through the face list and try to find the pictures. - * @param mainControl The main control. + * @param parent the parent component for showing dialog boxes + * @param archetypeSet the archetype set * @param editTypes the edit types instance * @param objects List of GameObjects to collect * @param uri URI they were read from (for error messages). * @param isInteractive if set, may ask to delete undefined archetypes; if * unset, keep undefined archetypes */ - void collectTempList(@NotNull MainControl<G, A, R, ?> mainControl, @NotNull EditTypes<G, A, R, ?> editTypes, List<G> objects, String uri, boolean isInteractive); + void collectTempList(@NotNull Component parent, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull EditTypes<G, A, R, ?> editTypes, List<G> objects, String uri, boolean isInteractive); } // interface GameObjectParser Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-29 08:04:45 UTC (rev 4572) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-29 08:19:17 UTC (rev 4573) @@ -932,7 +932,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> 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) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |